/**
 * Admin layout custom fixes - LTR/RTL margin, padding, icons
 * Matches Ubold 7 structure
 */

/* --------------------------------------------------------------------------
 * Corplift brand palette (https://corplift.sa)
 * Trust blue #1B365D = primary | Luxury gold #D4AF37 = accent | Deep frame #0F1419
 * -------------------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
  --corplift-blue: #1b365d;
  --corplift-blue-hover: #152a47;
  --corplift-gold: #d4af37;
  --corplift-gold-light: #f4e185;
  --corplift-black: #0f1419;
  --ins-primary: #1b365d;
  --ins-primary-rgb: 27, 54, 93;
  --ins-blue: #1b365d;
  --ins-link-color: #1b365d;
  --ins-link-hover-color: #152a47;
  --bs-primary: #1b365d;
  --bs-primary-rgb: 27, 54, 93;
  --bs-link-color: #1b365d;
  --bs-link-hover-color: #152a47;
}

[data-bs-theme="dark"] {
  --corplift-blue: #2a4d7c;
  --corplift-blue-hover: #3a62a0;
  --corplift-gold: #d4af37;
  --corplift-gold-light: #f4e185;
  --corplift-black: #0f1419;
  --ins-primary: #3d6fb8;
  --ins-primary-rgb: 61, 111, 184;
  --ins-blue: #3d6fb8;
  --ins-link-color: #7eb3ff;
  --ins-link-hover-color: #a8ccff;
  --bs-primary: #3d6fb8;
  --bs-primary-rgb: 61, 111, 184;
  --bs-link-color: #8ebfff;
  --bs-link-hover-color: #b8d6ff;
  --ins-body-bg: #0f1419;
  --ins-secondary-bg: #151c24;
  --ins-tertiary-bg: #1a232e;
}

/* Sidebar: transparent; topbar shell stays clear but menu bar gets solid backdrop */
.sidenav-menu {
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border-inline-end: 1px solid var(--ins-border-color);
}
header.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  isolation: isolate;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border-bottom: none !important;
}
header.app-topbar .container-fluid.topbar-menu,
header.app-topbar .topbar-menu.container-fluid {
  position: relative;
  z-index: 1;
  background-color: var(--ins-body-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ins-border-color) !important;
  min-height: var(--ins-topbar-height, 70px);
}
.content-page {
  position: relative;
  z-index: 1;
}
.content-page > .content > .container-fluid {
  position: relative;
  z-index: 1;
}
[data-bs-theme="dark"] .sidenav-menu {
  border-inline-end-color: rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] header.app-topbar .container-fluid.topbar-menu,
[data-bs-theme="dark"] header.app-topbar .topbar-menu.container-fluid {
  background-color: rgba(15, 20, 25, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

/* Gold accent: outline buttons / subtle highlights (optional use in UI) */
.btn-corplift-gold {
  --ins-btn-color: var(--corplift-black);
  --ins-btn-bg: var(--corplift-gold);
  --ins-btn-border-color: var(--corplift-gold);
  --ins-btn-hover-bg: #c19d2e;
  --ins-btn-hover-border-color: #c19d2e;
}

/* Arabic: Cairo font - override Ubold font variables so all text uses Cairo */
html[lang="ar"],
html[dir="rtl"] {
  --ins-font-sans-serif: "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  --ins-font-family-secondary: "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  --ins-body-font-family: "Cairo", sans-serif !important;
}
html[lang="ar"] body,
html[dir="rtl"] body {
  font-family: "Cairo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
html[lang="ar"] body *, 
html[dir="rtl"] body * {
  font-family: inherit !important;
}
/* Icons must keep their icon fonts (Cairo would break them) */
html[lang="ar"] .ti, html[lang="ar"] .ti:before, html[lang="ar"] [class^="ti-"], html[lang="ar"] [class*=" ti-"],
html[dir="rtl"] .ti, html[dir="rtl"] .ti:before, html[dir="rtl"] [class^="ti-"], html[dir="rtl"] [class*=" ti-"] {
  font-family: "tabler-icons" !important;
}
html[lang="ar"] [class^="ri-"], html[lang="ar"] [class*=" ri-"],
html[dir="rtl"] [class^="ri-"], html[dir="rtl"] [class*=" ri-"] {
  font-family: "remixicon" !important;
}

/* Ensure Tabler icons display and align correctly */
.ti, .ti:before, [class^="ti-"], [class*=" ti-"] {
  font-family: "tabler-icons" !important;
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: inline-block;
  vertical-align: middle;
}

/* Topbar: fix icon alignment in buttons */
.app-topbar .sidenav-toggle-button .ti,
.app-topbar .topnav-toggle-button .ti,
.app-topbar .topbar-link .ti {
  vertical-align: middle;
  line-height: 1;
}

/* Topbar buttons: match Ubold 7 - no extra padding/border on icon-only topbar-link */
.app-topbar .topbar-item .topbar-link:not(.dropdown-toggle) {
  padding: 0 0.5rem;
  min-width: 2.25rem;
}

/* RTL: zero margin-left (app.css sets it; app-rtl uses margin-right instead) */
[dir="rtl"] .app-topbar,
[dir="rtl"] .content-page {
  margin-left: 0;
}

/* Page title row (legacy page-title-box markup used in admin layout) */
.page-title-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 1.25rem 0 1rem;
  min-height: 0;
}
.page-title-box .page-title {
  order: 1;
  margin: 0;
  flex: 0 1 auto;
}
.page-title-box .page-title-right {
  order: 2;
  margin-inline-start: auto;
  flex: 0 1 auto;
}
.page-title-box .breadcrumb {
  padding: 0;
  margin: 0;
  justify-content: flex-end;
}

/* Card header: Ubold sets flex row — stack title row + filter row vertically */
.card-header.card-header-stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem !important;
}
.card-header.card-header-stacked > * {
  width: 100%;
  max-width: 100%;
}
.card-header-stacked .card-header-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem 0.75rem;
}
.card-header-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.card-header-title-group .header-title {
  margin-inline-end: 0 !important;
}

/* Filter toolbar: labels, selects, and buttons on one baseline */
.card-filter-toolbar {
  --toolbar-control-height: calc(0.775rem * 1.5 + 0.625rem + 2px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.card-filter-toolbar .form-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0;
  line-height: 1.5;
  min-height: var(--toolbar-control-height);
}
.card-filter-toolbar .form-select-sm {
  line-height: 1.5;
  min-height: var(--toolbar-control-height);
}
.card-filter-toolbar .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.5;
  min-height: var(--toolbar-control-height);
  box-shadow: none !important;
  --ins-btn-box-shadow: none;
}
.card-filter-toolbar .form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0;
  min-height: var(--toolbar-control-height);
}
.card-filter-toolbar .form-check-label {
  margin-bottom: 0;
  line-height: 1.5;
}

/* DataTables v1.x: length + search toolbar */
.card-body div.dataTables_wrapper > .row:first-child {
  margin-bottom: 0.75rem;
  align-items: center;
  --bs-gutter-y: 0.75rem;
}
.card-body div.dataTables_wrapper > .row:first-child > [class*="col-"] {
  display: flex;
  align-items: center;
}
.card-body div.dataTables_wrapper div.dataTables_length {
  text-align: start;
  width: 100%;
}
.card-body div.dataTables_wrapper div.dataTables_filter {
  text-align: end;
  width: 100%;
}
.card-body div.dataTables_wrapper div.dataTables_length label,
.card-body div.dataTables_wrapper div.dataTables_filter label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  white-space: normal;
}
.card-body div.dataTables_wrapper div.dataTables_length label {
  justify-content: flex-start;
}
.card-body div.dataTables_wrapper div.dataTables_filter label {
  justify-content: flex-end;
}
.card-body div.dataTables_wrapper div.dataTables_length select.form-select,
.card-body div.dataTables_wrapper div.dataTables_length select {
  width: auto;
  min-width: 5rem;
  flex: 0 0 auto;
  margin: 0 !important;
}
.card-body div.dataTables_wrapper div.dataTables_filter input.form-control,
.card-body div.dataTables_wrapper div.dataTables_filter input {
  width: auto;
  min-width: 12rem;
  max-width: 22rem;
  flex: 1 1 12rem;
  margin: 0 !important;
}
.card-body div.dataTables_wrapper > .row.dt-row {
  margin-top: 0;
  margin-bottom: 0;
}

/* Restore column padding stripped by DataTables inside table-responsive */
.card-body .table-responsive > div.dataTables_wrapper > div.row > [class*="col-"] {
  padding-inline: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
}

@media (max-width: 767.98px) {
  .card-body div.dataTables_wrapper div.dataTables_length,
  .card-body div.dataTables_wrapper div.dataTables_filter {
    text-align: center;
  }
  .card-body div.dataTables_wrapper div.dataTables_length label,
  .card-body div.dataTables_wrapper div.dataTables_filter label {
    justify-content: center;
  }
  .card-body div.dataTables_wrapper div.dataTables_filter input.form-control,
  .card-body div.dataTables_wrapper div.dataTables_filter input {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }
}

/* DataTables v1.x footer: separate pagination from last table row */
.card-body div.dataTables_wrapper table.dataTable {
  margin-bottom: 0 !important;
  margin-top: 0 !important;
}
.card-body div.dataTables_wrapper > .row:last-child {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ins-border-color);
  align-items: center;
}
.card-body div.dataTables_wrapper div.dataTables_info,
.card-body div.dataTables_wrapper div.dataTables_paginate {
  padding-top: 0;
  margin-top: 0;
}
.card-body div.dataTables_wrapper .dataTables_paginate .pagination {
  margin-bottom: 0;
  gap: 0.25rem;
}
.card-body div.dataTables_wrapper .page-item .page-link {
  line-height: 1.5;
}
@media (max-width: 767.98px) {
  .card-body div.dataTables_wrapper div.dataTables_info,
  .card-body div.dataTables_wrapper div.dataTables_paginate {
    text-align: center;
  }
  .card-body div.dataTables_wrapper .dataTables_paginate .pagination {
    justify-content: center !important;
  }
}

/* Card titles beside action buttons */
.card-header:not(.card-header-stacked) .header-title,
.card-header:not(.card-header-stacked) .card-title,
.card-header:not(.card-header-stacked) > h4,
.card-header:not(.card-header-stacked) > h5 {
  margin-inline-end: 0.75rem;
}
.header-title,
.card-title {
  margin-inline-end: 0.75rem;
}

/* Permission Matrix & cards: dark mode coloring (Ubold 7) */
[data-bs-theme=dark] .table thead.table-light th,
[data-bs-theme=dark] .table thead.table-light td {
  background-color: var(--ins-tertiary-bg);
  color: var(--ins-body-color);
  border-color: rgba(131, 145, 162, 0.4) !important;
}
[data-bs-theme=dark] tr.table-secondary td {
  background-color: var(--ins-secondary-bg);
  color: var(--ins-body-color);
  border-color: rgba(131, 145, 162, 0.4) !important;
}
[data-bs-theme=dark] .card .card-header.bg-light,
[data-bs-theme=dark] .card .card-footer.bg-light {
  background-color: var(--ins-secondary-bg) !important;
  border-color: var(--ins-border-color);
  color: var(--ins-body-color);
}
[data-bs-theme=dark] .list-group-item {
  background-color: var(--ins-secondary-bg);
  color: var(--ins-body-color);
  border-color: var(--ins-border-color);
}
[data-bs-theme=dark] .table.table-bordered {
  --ins-table-bg: var(--ins-secondary-bg);
  --ins-table-color: var(--ins-body-color);
  --ins-table-border-color: rgba(131, 145, 162, 0.4);
}
[data-bs-theme=dark] .table.table-bordered,
[data-bs-theme=dark] .table.table-bordered th,
[data-bs-theme=dark] .table.table-bordered td {
  border-color: rgba(131, 145, 162, 0.4) !important;
  background-color: var(--ins-secondary-bg);
  color: var(--ins-body-color);
}
[data-bs-theme=dark] .table.table-bordered thead th {
  background-color: var(--ins-tertiary-bg) !important;
  border-color: rgba(131, 145, 162, 0.4) !important;
}
[data-bs-theme=dark] .table.table-bordered tbody tr td {
  border-color: rgba(131, 145, 162, 0.4) !important;
}
[data-bs-theme=dark] .table.table-bordered tbody tr {
  --ins-table-bg: var(--ins-secondary-bg);
}
[data-bs-theme=dark] .table-responsive {
  border-color: rgba(131, 145, 162, 0.2);
}

/* Permissions page: matrix table style (close to Ubold 7 in light/dark) */
.permission-matrix-table-wrap {
  border: 1px solid var(--ins-border-color);
  border-radius: 0.5rem;
}
.permission-matrix-table {
  --ins-table-bg: transparent;
}
.permission-matrix-table thead.permission-matrix-head th {
  background-color: var(--ins-light);
  color: var(--ins-emphasis-color);
  font-weight: 600;
  white-space: nowrap;
}
.permission-matrix-table .permission-matrix-group-row td {
  background-color: var(--ins-light-bg-subtle);
  color: var(--ins-emphasis-color);
  font-weight: 600;
}
.permission-matrix-table td,
.permission-matrix-table th {
  vertical-align: middle;
}

[data-bs-theme=dark] .permission-matrix-table-wrap {
  border-color: rgba(131, 145, 162, 0.35);
}
[data-bs-theme=dark] .permission-matrix-table.table-bordered,
[data-bs-theme=dark] .permission-matrix-table.table-bordered th,
[data-bs-theme=dark] .permission-matrix-table.table-bordered td {
  border-color: rgba(131, 145, 162, 0.35) !important;
}
[data-bs-theme=dark] .permission-matrix-table tbody tr td {
  background-color: var(--ins-secondary-bg);
  color: var(--ins-body-color);
}
[data-bs-theme=dark] .permission-matrix-table thead.permission-matrix-head th {
  background-color: var(--ins-tertiary-bg) !important;
  color: var(--ins-emphasis-color);
}
[data-bs-theme=dark] .permission-matrix-table .permission-matrix-group-row td {
  background-color: var(--ins-tertiary-bg);
  color: var(--ins-emphasis-color);
}

/* Dashboard stat cards (widget-flat): dark mode fixes */
[data-bs-theme=dark] .card.widget-flat.text-bg-primary,
[data-bs-theme=dark] .card.widget-flat.text-bg-success,
[data-bs-theme=dark] .card.widget-flat.text-bg-info,
[data-bs-theme=dark] .card.widget-flat.text-bg-warning {
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
[data-bs-theme=dark] .card.widget-flat .card-body,
[data-bs-theme=dark] .card.widget-flat .card-body h6,
[data-bs-theme=dark] .card.widget-flat .card-body h2,
[data-bs-theme=dark] .card.widget-flat .card-body p,
[data-bs-theme=dark] .card.widget-flat .card-body span,
[data-bs-theme=dark] .card.widget-flat .card-body .widget-icon,
[data-bs-theme=dark] .card.widget-flat .card-body i {
  color: #fff !important;
}
[data-bs-theme=dark] .card.widget-flat .badge.bg-white.bg-opacity-10 {
  background-color: rgba(255, 255, 255, 0.3) !important;
  color: #fff !important;
}

/* Choices.js (form-select): selected value text follows theme (if plugin choices.min.css is ever loaded, it won’t wash out dark mode) */
.choices__inner .choices__list--single .choices__item {
  color: var(--ins-body-color);
}

/* Brand logos — Future Waves (sidebar / topbar / auth) */
.sidenav-menu > a.logo {
  min-height: var(--ins-topbar-height, 70px);
  height: var(--ins-topbar-height, 70px);
  padding: 0.55rem 12px 0.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: none;
  background: transparent !important;
}
/* Ubold also styles inner span.logo wrappers — strip sticky/padding/bg so no gray box shows */
.sidenav-menu > a.logo > span.logo.logo-light,
.sidenav-menu > a.logo > span.logo.logo-dark {
  position: static !important;
  top: auto !important;
  line-height: 1 !important;
  padding: 0 !important;
  margin: 0;
  background: transparent !important;
  box-shadow: none !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu .logo,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) .logo {
  background: transparent !important;
  box-shadow: none !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu > a.logo,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) > a.logo {
  min-height: var(--ins-topbar-height, 70px) !important;
  height: var(--ins-topbar-height, 70px) !important;
  padding: 0.55rem 8px 0.3rem !important;
  background: transparent !important;
}
/* Keep menu vertical position when sidebar collapses (titles hide but keep their slot) */
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav-title,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) .side-nav-title {
  display: block !important;
  visibility: hidden;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  margin: 0 !important;
  padding: var(--ins-sidenav-item-padding-y, 0.625rem) calc(var(--ins-sidenav-item-padding-x, 1.25rem) * 2) !important;
  font-size: calc(var(--ins-sidenav-item-font-size, 0.875rem) * 0.7) !important;
  line-height: 1.25 !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 0;
}
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav > .side-nav-title.mt-2,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) .side-nav > .side-nav-title.mt-2 {
  margin-top: 0.5rem !important;
}
/* Smooth width-only sidebar animation; avoid link layout jumps */
.sidenav-menu {
  transition: width 0.25s ease-in-out !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu .side-nav .side-nav-item .side-nav-link,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) .side-nav .side-nav-item .side-nav-link {
  transition: background-color 0.2s ease, color 0.2s ease !important;
}
.sidenav-menu > a.logo span.logo-lg {
  display: block !important;
}
.sidenav-menu > a.logo span.logo-sm {
  display: none !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu > a.logo span.logo-lg,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) > a.logo span.logo-lg {
  display: none !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu > a.logo span.logo-sm,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) > a.logo span.logo-sm {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 !important;
  line-height: 1 !important;
  background: transparent !important;
}
.sidenav-menu .logo img.admin-brand-logo-sidebar {
  height: auto;
  max-height: 40px;
  width: auto;
  max-width: min(220px, 90%);
  object-fit: contain;
  display: block;
}
.sidenav-menu .logo img.admin-brand-logo-sidebar-sm {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
  object-position: center;
  display: block;
  flex-shrink: 0;
  background: transparent !important;
}
html[data-sidenav-size="condensed"] .sidenav-menu .logo img.admin-brand-logo-sidebar-sm,
html[data-sidenav-size="on-hover"] .sidenav-menu:not(:hover) .logo img.admin-brand-logo-sidebar-sm {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
}
.logo-topbar {
  padding-top: 0.35rem;
  padding-bottom: 0.15rem;
  line-height: 1.2;
  box-sizing: border-box;
}
.logo-topbar img.admin-brand-logo-topbar {
  height: auto !important;
  max-height: 34px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
}
.logo-topbar img.admin-brand-logo-topbar-sm {
  height: auto !important;
  max-height: 28px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}
.auth-brand .auth-login-logo,
.auth-login-logo {
  height: auto;
  max-height: 40px;
  width: auto;
  max-width: min(240px, 100%);
  object-fit: contain;
}
/* Auth / welcome logos: Bootstrap d-inline-block overrides Ubold theme toggle */
.auth-brand .logo-dark,
.auth-brand a.logo-dark,
.welcome-logo .logo-dark {
  display: inline-block !important;
}
.auth-brand .logo-light,
.auth-brand a.logo-light,
.welcome-logo .logo-light {
  display: none !important;
}
html[data-bs-theme="dark"] .auth-brand .logo-light,
html[data-bs-theme="dark"] .auth-brand a.logo-light,
html[data-bs-theme="dark"] .welcome-logo .logo-light {
  display: inline-block !important;
}
html[data-bs-theme="dark"] .auth-brand .logo-dark,
html[data-bs-theme="dark"] .auth-brand a.logo-dark,
html[data-bs-theme="dark"] .welcome-logo .logo-dark {
  display: none !important;
}

/* RTL: table columns align right (whole admin panel; preserve explicit center columns e.g. actions) */
html[dir="rtl"] .table thead th,
html[dir="rtl"] .table tbody td {
  text-align: right;
}
html[dir="rtl"] .table thead th.text-center,
html[dir="rtl"] .table tbody td.text-center,
html[dir="rtl"] .table .text-center {
  text-align: center !important;
}
html[dir="rtl"] table.dataTable thead th,
html[dir="rtl"] table.dataTable tbody td {
  text-align: right !important;
}
html[dir="rtl"] table.dataTable thead th.text-center,
html[dir="rtl"] table.dataTable tbody td.text-center {
  text-align: center !important;
}
html[dir="rtl"] div.dt-container table.dataTable thead th,
html[dir="rtl"] div.dt-container table.dataTable tbody td {
  text-align: right !important;
}
html[dir="rtl"] div.dt-container table.dataTable thead th.text-center,
html[dir="rtl"] div.dt-container table.dataTable tbody td.text-center {
  text-align: center !important;
}

/* Finance overview (/admin/finance) */
.finance-flow-card,
.finance-stat-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: none;
}
.finance-stat-card-plus { border-right: 3px solid #22c55e; }
.finance-stat-card-minus { border-right: 3px solid #ef4444; }
html[dir="rtl"] .finance-stat-card-plus { border-right: none; border-left: 3px solid #22c55e; }
html[dir="rtl"] .finance-stat-card-minus { border-right: none; border-left: 3px solid #ef4444; }

.finance-flow-equation { min-height: 3.5rem; }
.finance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
}
.finance-pill-plus {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.25);
}
.finance-pill-minus {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
}
.finance-pill-result { transform: scale(1.03); }
.finance-pill-label {
  display: block;
  font-size: 0.7rem;
  color: #6c757d;
  line-height: 1.2;
}
.finance-pill-value,
.finance-stat-value {
  display: block;
  font-size: 1.05rem;
  color: var(--ins-emphasis-color, #212529);
  line-height: 1.3;
}
.finance-stat-card h2.finance-stat-value,
.finance-stat-card h3.finance-stat-value {
  font-size: inherit;
}
.finance-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.finance-pill-plus .finance-sign {
  background: #22c55e;
  color: #fff;
}
.finance-pill-minus .finance-sign {
  background: #ef4444;
  color: #fff;
}

.finance-amount-plus { color: #16a34a !important; font-weight: 600; }
.finance-amount-minus { color: #dc2626 !important; font-weight: 600; }

.finance-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  font-size: 1.1rem;
}
.finance-icon-plus { background: rgba(34, 197, 94, 0.15); color: #16a34a; }
.finance-icon-minus { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.finance-icon-neutral { background: rgba(27, 54, 93, 0.08); color: #1b365d; }

.finance-net-display {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  margin-bottom: 0.35rem;
}
.finance-net-sign {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}
.finance-net-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}
.finance-net-positive .finance-net-sign,
.finance-net-positive .finance-net-value { color: #16a34a; }
.finance-net-negative .finance-net-sign,
.finance-net-negative .finance-net-value { color: #dc2626; }

.finance-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.finance-chip-plus {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
}
.finance-chip-minus {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}

.finance-table-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  vertical-align: middle;
}
.finance-table-badge-plus { background: #22c55e; color: #fff; }
.finance-table-badge-minus { background: #ef4444; color: #fff; }

.finance-card-header {
  background: transparent;
}
.finance-table-head th {
  background-color: var(--ins-tertiary-bg, #f8f9fa);
  color: var(--ins-emphasis-color, inherit);
  border-bottom-color: var(--ins-border-color, #dee2e6);
}

/* Finance overview — dark mode */
[data-bs-theme="dark"] .finance-overview .finance-flow-card,
[data-bs-theme="dark"] .finance-overview .finance-stat-card {
  background: var(--ins-secondary-bg);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="dark"] .finance-overview .finance-pill-plus {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(74, 222, 128, 0.35);
}
[data-bs-theme="dark"] .finance-overview .finance-pill-minus {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.35);
}
[data-bs-theme="dark"] .finance-overview .finance-pill-label {
  color: rgba(255, 255, 255, 0.55);
}
[data-bs-theme="dark"] .finance-overview .finance-pill-value,
[data-bs-theme="dark"] .finance-overview .finance-stat-value {
  color: var(--ins-emphasis-color);
}
[data-bs-theme="dark"] .finance-overview .finance-amount-plus { color: #4ade80 !important; }
[data-bs-theme="dark"] .finance-overview .finance-amount-minus { color: #f87171 !important; }
[data-bs-theme="dark"] .finance-overview .finance-icon-plus {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
}
[data-bs-theme="dark"] .finance-overview .finance-icon-minus {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}
[data-bs-theme="dark"] .finance-overview .finance-icon-neutral {
  background: rgba(126, 179, 255, 0.15);
  color: #7eb3ff;
}
[data-bs-theme="dark"] .finance-overview .finance-net-positive .finance-net-sign,
[data-bs-theme="dark"] .finance-overview .finance-net-positive .finance-net-value { color: #4ade80; }
[data-bs-theme="dark"] .finance-overview .finance-net-negative .finance-net-sign,
[data-bs-theme="dark"] .finance-overview .finance-net-negative .finance-net-value { color: #f87171; }
[data-bs-theme="dark"] .finance-overview .finance-chip-plus {
  color: #86efac;
  background: rgba(34, 197, 94, 0.2);
}
[data-bs-theme="dark"] .finance-overview .finance-chip-minus {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.2);
}
[data-bs-theme="dark"] .finance-overview .finance-card-header {
  background: var(--ins-secondary-bg);
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .finance-overview .finance-card-header .header-title {
  color: var(--ins-emphasis-color);
}
[data-bs-theme="dark"] .finance-overview .finance-table-head th {
  background-color: var(--ins-tertiary-bg);
  color: var(--ins-emphasis-color);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="dark"] .finance-overview .card .table tbody td {
  color: var(--ins-body-color);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-bs-theme="dark"] .finance-overview .text-warning {
  color: #fbbf24 !important;
}
[data-bs-theme="dark"] .finance-overview .text-info {
  color: #67e8f9 !important;
}
[data-bs-theme="dark"] .finance-overview .text-success {
  color: #4ade80 !important;
}

/* Expenses — quick add bar */
.expense-quick-card {
  background: #fff;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-inline-start: 3px solid #ef4444;
  box-shadow: none;
}
.expense-quick-title {
  color: var(--ins-emphasis-color, #212529);
}
.expense-quick-badge {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.45rem 0.65rem;
}
.expense-quick-badge-code {
  background: rgba(27, 54, 93, 0.08);
  color: #1b365d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.02em;
}
.expense-quick-form .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ins-emphasis-color, #212529);
}
[data-bs-theme="dark"] .expense-quick-card {
  background: var(--ins-secondary-bg);
  border-color: rgba(248, 113, 113, 0.25);
  border-inline-start-color: #f87171;
}
[data-bs-theme="dark"] .expense-quick-title {
  color: var(--ins-emphasis-color);
}
[data-bs-theme="dark"] .expense-quick-badge {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
}
[data-bs-theme="dark"] .expense-quick-badge-code {
  background: rgba(126, 179, 255, 0.15);
  color: #7eb3ff;
}
[data-bs-theme="dark"] .expense-quick-form .form-label {
  color: var(--ins-emphasis-color);
}

.expense-amount-minus {
  display: inline-block;
  color: #dc2626;
  font-weight: 700;
  white-space: nowrap;
}
.expense-amount-input-group .expense-amount-prefix {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
  font-size: 1.15rem;
  font-weight: 800;
  min-width: 2.5rem;
  justify-content: center;
}
.expense-amount-input-group .expense-amount-input {
  font-weight: 600;
  color: #dc2626;
}
.expense-amount-input-group .expense-amount-input::placeholder {
  color: rgba(220, 38, 38, 0.45);
}
[data-bs-theme="dark"] .expense-amount-minus {
  color: #f87171;
}
[data-bs-theme="dark"] .expense-amount-input-group .expense-amount-prefix {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.35);
  color: #f87171;
}
[data-bs-theme="dark"] .expense-amount-input-group .expense-amount-input {
  color: #f87171;
}
[data-bs-theme="dark"] .expense-amount-input-group .expense-amount-input::placeholder {
  color: rgba(248, 113, 113, 0.45);
}

/* Client show page */
.client-show-page .client-panel-box,
.client-show-page .client-section-box {
  background: #fff;
}
.client-show-page .client-section-box {
  border: 1px dashed rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  overflow: visible;
}
.client-show-page .client-dropzone {
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.client-show-page .client-dropzone-empty {
  cursor: pointer;
}
.client-show-page .client-dropzone-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 12;
  align-items: center;
  justify-content: center;
  background: rgba(27, 54, 93, 0.08);
  border-radius: inherit;
  pointer-events: none;
}
.client-show-page .client-dropzone.is-dragover {
  border-color: var(--ins-primary, #1b365d);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(27, 54, 93, 0.12);
}
.client-show-page .client-dropzone.is-dragover .client-dropzone-overlay {
  display: flex;
}
.client-show-page .client-dropzone-overlay-inner {
  padding: 1.5rem;
  color: var(--ins-primary, #1b365d);
}
.client-show-page .client-dropzone .client-upload-form,
.client-show-page .client-dropzone .table-responsive,
.client-show-page .client-dropzone .client-empty-state {
  position: relative;
  z-index: 1;
}
[data-bs-theme="dark"] .client-show-page .client-dropzone.is-dragover {
  border-color: #7eb3ff;
  box-shadow: 0 0 0 3px rgba(126, 179, 255, 0.18);
}
[data-bs-theme="dark"] .client-show-page .client-dropzone-overlay {
  background: rgba(126, 179, 255, 0.12);
}
[data-bs-theme="dark"] .client-show-page .client-dropzone-overlay-inner {
  color: #7eb3ff;
}
.client-show-page .client-empty-state {
  background: #fff;
}
.client-show-page .client-upload-form {
  background: #f8f9fa;
}
.client-show-page .client-table-head th {
  background-color: var(--ins-tertiary-bg, #f8f9fa);
  color: var(--ins-emphasis-color, inherit);
}
.client-show-page .client-code-badge {
  background: rgba(27, 54, 93, 0.08);
  color: #1b365d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.client-show-page .client-contract-code {
  color: #1b365d;
  font-size: 0.85rem;
}
.client-show-page .client-notes-feed {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.client-show-page .client-note-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
  background: #fff;
}
.client-show-page .client-note-avatar {
  width: 42px;
  height: 42px;
  object-fit: cover;
  flex-shrink: 0;
}
.client-show-page .client-note-body {
  flex: 1;
  min-width: 0;
}
.client-show-page .client-note-author {
  color: var(--ins-emphasis-color, #212529);
}
.client-show-page .client-note-text {
  white-space: pre-wrap;
  color: var(--ins-body-color, #495057);
  line-height: 1.5;
}
[data-bs-theme="dark"] .client-show-page .client-panel-box,
[data-bs-theme="dark"] .client-show-page .client-section-box,
[data-bs-theme="dark"] .client-show-page .client-empty-state,
[data-bs-theme="dark"] .client-show-page .client-note-item {
  background: var(--ins-secondary-bg);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="dark"] .client-show-page .client-upload-form {
  background: var(--ins-tertiary-bg);
  border-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .client-show-page .client-code-badge {
  background: rgba(126, 179, 255, 0.15);
  color: #7eb3ff;
}
[data-bs-theme="dark"] .client-show-page .client-contract-code {
  color: #7eb3ff;
}
[data-bs-theme="dark"] .client-show-page .client-note-author {
  color: var(--ins-emphasis-color);
}
[data-bs-theme="dark"] .client-show-page .client-note-text {
  color: var(--ins-body-color);
}
[data-bs-theme="dark"] .client-show-page .text-success {
  color: #4ade80 !important;
}
[data-bs-theme="dark"] .client-show-page .text-warning {
  color: #fbbf24 !important;
}
