/* Arotalk CRM — responsive layout (mobile-first fixes) */

/* ── Core mobile shell (fixes Tabler vertical sidebar layout) ─ */
@media (max-width: 991.98px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  .page {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  /* Off-canvas sidebar drawer */
  .navbar-vertical.navbar-expand-lg {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(280px, 88vw) !important;
    max-width: 88vw !important;
    z-index: 1050 !important;
    transform: translateX(-105%);
    transition: transform 0.25s ease-in-out;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
  }

  body.sidebar-open .navbar-vertical.navbar-expand-lg {
    transform: translateX(0);
  }

  /* Hide sidebar's own toggler — topbar toggler is used */
  .navbar-vertical > .container-fluid > .navbar-toggler {
    display: none !important;
  }

  .navbar-vertical .navbar-collapse {
    display: block !important;
    visibility: visible !important;
  }

  .page-wrapper {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
  }

  .page-body,
  .page-header,
  .container-xl {
    max-width: 100%;
    min-width: 0;
  }

  .page-body .container-xl,
  .page-header .container-xl,
  header.navbar .container-xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(15, 23, 42, 0.5);
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

body.sidebar-open {
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .navbar-vertical .dropdown-menu {
    position: static !important;
    transform: none !important;
    float: none;
    box-shadow: none;
    border: 0;
    background: transparent;
    padding: 0 0 0 0.5rem;
    margin: 0;
  }

  .navbar-vertical .dropdown-item {
    padding: 0.45rem 0.75rem;
  }
}

/* ── Page header spacing ──────────────────────────────────── */
.page-header.d-print-none,
.page-header {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 1.25rem !important;
  padding-bottom: 1.25rem !important;
}
.page-header + .page-body {
  padding-top: 0.25rem;
}
@media (min-width: 992px) {
  .page-header.d-print-none,
  .page-header {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
}

.flash-messages {
  padding: 0.5rem 0 0;
}

.flash-messages .alert:last-child {
  margin-bottom: 0.5rem;
}

/* ── Toast popups (flash messages) ────────────────────────── */
.toast-stack {
  position: fixed;
  top: 4.25rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: min(400px, calc(100vw - 2rem));
  pointer-events: none;
}

.auth-layout .toast-stack,
.page-center ~ .toast-stack,
body:not(:has(.page-wrapper)) .toast-stack {
  top: 1rem;
}

.toast-popup {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 2.25rem 0.85rem 0.85rem;
  border-radius: 12px;
  background: var(--tblr-bg-surface, #fff);
  border: 1px solid var(--tblr-border-color, #e2e8f0);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  overflow: hidden;
  animation: toast-slide-in 0.35s cubic-bezier(0.21, 1, 0.32, 1);
}

.toast-popup.toast-hiding {
  animation: toast-slide-out 0.28s ease forwards;
}

@keyframes toast-slide-in {
  from { opacity: 0; transform: translateX(1.25rem) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toast-slide-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(1.25rem); }
}

.toast-popup-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.toast-popup-success .toast-popup-icon { background: rgba(47, 179, 68, 0.15); color: #2fb344; }
.toast-popup-danger  .toast-popup-icon { background: rgba(214, 57, 57, 0.12); color: #d63939; }
.toast-popup-warning .toast-popup-icon { background: rgba(247, 103, 7, 0.12); color: #f76707; }
.toast-popup-info    .toast-popup-icon { background: rgba(66, 153, 225, 0.12); color: #4299e1; }

.toast-popup-success { border-left: 4px solid #2fb344; }
.toast-popup-danger  { border-left: 4px solid #d63939; }
.toast-popup-warning { border-left: 4px solid #f76707; }
.toast-popup-info    { border-left: 4px solid #4299e1; }

.toast-popup-body {
  flex: 1;
  min-width: 0;
}

.toast-popup-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  margin-bottom: 0.15rem;
}

.toast-popup-message {
  font-size: 0.85rem;
  color: var(--tblr-secondary, #64748b);
  line-height: 1.45;
  word-break: break-word;
}

.toast-popup-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: 0;
  background: transparent;
  color: var(--tblr-secondary, #94a3b8);
  padding: 0.15rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.toast-popup-close:hover {
  color: var(--tblr-body-color, #1e293b);
  background: rgba(0, 0, 0, 0.05);
}

.toast-popup-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform-origin: left;
  animation-name: toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.toast-popup-success .toast-popup-progress { background: #2fb344; }
.toast-popup-danger  .toast-popup-progress { background: #d63939; }
.toast-popup-warning .toast-popup-progress { background: #f76707; }
.toast-popup-info    .toast-popup-progress { background: #4299e1; }

@keyframes toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@media (max-width: 575.98px) {
  .toast-stack {
    top: auto;
    bottom: 1rem;
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }

  .page-wrapper ~ .toast-stack,
  body:has(.page-wrapper) .toast-stack {
    top: auto;
    bottom: 1rem;
  }

  .toast-popup {
    animation-name: toast-slide-up;
  }

  .toast-popup.toast-hiding {
    animation-name: toast-slide-down;
  }

  @keyframes toast-slide-up {
    from { opacity: 0; transform: translateY(1rem); }
    to   { opacity: 1; transform: translateY(0); }
  }

  @keyframes toast-slide-down {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(1rem); }
  }
}

.page-header-avatar {
  font-size: 1.75rem;
}

/* ── Page header & actions ──────────────────────────────── */
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

@media (max-width: 767.98px) {
  .page-header-actions-wrap {
    width: 100%;
    margin-top: 0.75rem;
    margin-left: 0 !important;
  }

  .page-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .page-header-actions > .btn,
  .page-header-actions > a.btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 0;
    justify-content: center;
    text-align: center;
  }

  .page-header-actions > .btn:only-child,
  .page-header-actions > a.btn:only-child {
    flex: 1 1 100%;
  }

  .page-header-actions > form {
    flex: 1 1 100%;
    width: 100%;
  }

  .page-header-actions .form-select,
  .page-header-actions .form-control {
    width: 100% !important;
    max-width: 100%;
  }

  .page-header-subtitle .ms-3 {
    display: block;
    margin-left: 0 !important;
    margin-top: 0.35rem;
  }
}

@media (max-width: 575.98px) {
  .page-header .page-title {
    font-size: 1.35rem;
  }

  .page-header .btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
  }

  .page-header.d-print-none,
  .page-header {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .page-body {
    padding-top: 0.5rem;
  }
}

/* ── Filter toolbars in cards ───────────────────────────── */
@media (max-width: 767.98px) {
  .card-body.border-bottom form.row > [class*="col"],
  .card-header form.row > [class*="col"],
  .card-body form.row > [class*="col"]:not([class*="col-12"]) {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }

  .card-body.border-bottom form.row .col-auto,
  .card-header form.row .col-auto {
    margin-left: 0 !important;
  }

  .card-body.border-bottom form.row .btn,
  .card-header form.row .btn,
  .card-body form.row .btn {
    width: 100%;
  }

  .card-body form.row .form-select,
  .card-body form.row .form-control {
    width: 100%;
  }
}

/* ── Data tables (auto-scroll cards without wrapper) ───── */
.table-responsive {
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0;
  max-width: 100%;
}

@media (max-width: 991.98px) {
  .card:has(> .table),
  .card-body:has(> .table),
  .card-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .card > .table,
  .card-body > .table {
    min-width: 560px;
  }

  .table.card-table {
    font-size: 0.875rem;
  }

  .table.card-table .btn-sm,
  .table.card-table .btn-icon {
    padding: 0.2rem 0.45rem;
  }
}

/* ── Kanban board ───────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.75rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

@media (max-width: 767.98px) {
  .kanban-board {
    gap: 0.65rem;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .kanban-column {
    min-width: min(88vw, 300px) !important;
    max-width: min(88vw, 300px) !important;
    flex: 0 0 min(88vw, 300px) !important;
    scroll-snap-align: start;
  }

  .kanban-column .card-list {
    min-height: 40vh !important;
  }
}

/* ── Dashboard stat cards ─────────────────────────────────── */
@media (max-width: 575.98px) {
  .stat-card .h1 {
    font-size: 1.75rem;
  }

  #pipelineChart,
  #leadsChart {
    min-height: 200px;
  }

  .row-cards > [class*="col-"] {
    margin-bottom: 0.5rem;
  }
}

/* ── Topbar ───────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  header.navbar {
    min-height: 52px;
    z-index: 1030;
  }

  header.navbar .container-xl {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    max-width: 100%;
  }

  header.navbar .navbar-nav {
    flex-wrap: nowrap;
  }
}

@media (max-width: 575.98px) {
  header.navbar .nav-link.px-2 {
    padding-left: 0.3rem !important;
    padding-right: 0.3rem !important;
  }

  header.navbar .dropdown-menu-card {
    position: fixed !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    transform: none !important;
    top: 3.25rem !important;
  }

  header.navbar .avatar + div {
    display: none !important;
  }
}

/* ── Horizontal layout nav ──────────────────────────────── */
@media (max-width: 991.98px) {
  .horizontal-nav-wrap .container-xl {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .horizontal-nav-wrap .navbar-nav {
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-bottom: 0.25rem;
  }

  .horizontal-nav-wrap .nav-link {
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* ── Pagination ───────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .pagination-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    text-align: center;
    gap: 0.75rem !important;
  }

  .pagination-toolbar > div:last-child {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pagination-toolbar .pagination {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ── Forms, modals, detail pages ──────────────────────────── */
@media (max-width: 767.98px) {
  .modal-dialog {
    margin: 0.75rem;
    max-width: calc(100vw - 1.5rem);
  }

  .input-group-flat {
    flex-wrap: wrap;
  }

  .row.row-cards .col-lg-8,
  .row.row-cards .col-lg-4,
  .row.row-cards .col-md-8,
  .row.row-cards .col-md-4 {
    margin-bottom: 0.75rem;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card-actions {
    margin-top: 0.5rem;
    width: 100%;
  }

  .card-actions .btn {
    width: 100%;
    margin-bottom: 0.35rem;
  }

  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs .nav-link {
    white-space: nowrap;
  }
}

/* ── Auth pages ───────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .page-center .container-tight {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 100%;
  }

  .auth-card .card-body {
    padding: 1.25rem;
  }
}

/* ── Utilities ──────────────────────────────────────────────── */
.w-mobile-100 {
  width: 100% !important;
}

@media (max-width: 767.98px) {
  .text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
}

/* ── Client detail dashboard ───────────────────────────────── */
.client-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(14, 165, 233, 0.06) 50%, rgba(34, 197, 94, 0.05) 100%);
  border: 0;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

[data-bs-theme="dark"] .client-hero {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(15, 23, 42, 0.4) 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.client-hero-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.client-health-ring {
  --health-pct: 75;
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(
    var(--health-color, #22c55e) calc(var(--health-pct) * 1%),
    rgba(148, 163, 184, 0.25) 0
  );
  padding: 4px;
}

.client-health-green { --health-color: #22c55e; }
.client-health-yellow { --health-color: #f59e0b; }
.client-health-red { --health-color: #ef4444; }

.client-health-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--tblr-bg-surface, #fff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.client-kpi-card {
  border-left: 3px solid var(--kpi-accent, #6366f1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.client-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.client-kpi-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-secondary);
  margin-bottom: 0.35rem;
}

.client-kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.client-kpi-hint {
  font-size: 0.75rem;
  color: var(--tblr-secondary);
  margin-top: 0.25rem;
}

@media (max-width: 991.98px) {
  .client-kpi-value {
    font-size: 1rem;
  }

  .client-hero h2 {
    font-size: 1.25rem;
  }
}

/* ── Client detail tabs ────────────────────────────────────── */
.client-tabs-card > .card-header {
  padding-bottom: 0;
  border-bottom: 0;
}

.client-detail-tabs {
  margin-bottom: -1px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.client-detail-tabs::-webkit-scrollbar {
  display: none;
}

.client-detail-tabs .nav-item {
  flex-shrink: 0;
}

.client-detail-tabs .nav-link {
  font-weight: 500;
  white-space: nowrap;
  border-bottom-width: 2px;
}

.client-detail-tabs .nav-link.active {
  font-weight: 600;
}

.client-tabs-card .tab-content > .tab-pane {
  display: none;
}

.client-tabs-card .tab-content > .tab-pane.active {
  display: block;
}

.client-snap-stat {
  background: var(--tblr-bg-surface-secondary, #f8fafc);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  height: 100%;
}

.client-snap-stat-label {
  font-size: 0.75rem;
  color: var(--tblr-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.client-snap-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0.15rem 0 0.35rem;
}

.client-panel {
  background: var(--tblr-bg-surface-secondary, #f8fafc);
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

[data-bs-theme="dark"] .client-panel {
  background: rgba(15, 23, 42, 0.35);
  border-color: rgba(148, 163, 184, 0.1);
}

.client-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.client-panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.client-panel-sub {
  font-size: 0.75rem;
  color: var(--tblr-secondary);
  margin-top: 0.15rem;
}

.client-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--tblr-secondary);
}

.client-empty i {
  font-size: 2rem;
  opacity: 0.35;
  display: block;
  margin-bottom: 0.5rem;
}

.client-empty-sm {
  padding: 1.25rem 0.5rem;
}

.client-empty-sm i {
  font-size: 1.5rem;
}

.client-inv-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.client-inv-row {
  display: block;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: var(--tblr-bg-surface, #fff);
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.client-inv-row:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
  color: inherit;
}

.client-inv-top,
.client-inv-mid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.client-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.25rem;
}

.client-timeline-item {
  display: flex;
  gap: 0.75rem;
  padding-bottom: 1rem;
  position: relative;
}

.client-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.85rem;
  top: 1.75rem;
  bottom: 0;
  width: 2px;
  background: rgba(148, 163, 184, 0.25);
}

.client-timeline-dot {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.client-timeline-body {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
}

.client-timeline-body time {
  font-size: 0.7rem;
  color: var(--tblr-secondary);
}

.client-mini-cards {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.client-mini-card {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--tblr-bg-surface, #fff);
  border: 1px solid transparent;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s;
}

.client-mini-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  color: inherit;
}

.client-reach-card {
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.1) 0%, rgba(14, 165, 233, 0.06) 100%);
  border-radius: 0.75rem;
  padding: 1.25rem;
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.client-reach-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tblr-secondary);
  margin-bottom: 0.25rem;
}

.client-reach-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
}

.client-reach-link:hover {
  color: var(--tblr-primary);
}

.client-reach-link i {
  width: 1.25rem;
  opacity: 0.7;
}

#gstTable .form-control,
#contactsTable .form-control {
  border-color: transparent;
  background: transparent;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

#gstTable .form-control:focus,
#contactsTable .form-control:focus {
  border-color: var(--tblr-primary);
  background: var(--tblr-bg-surface, #fff);
}

.client-simple-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--tblr-secondary);
  font-weight: 600;
}

.client-simple-dl {
  margin: 0;
}

.client-simple-dl-row {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.client-simple-dl-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.client-simple-dl-row dt {
  flex: 0 0 6rem;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tblr-secondary);
}

.client-simple-dl-row dd {
  flex: 1;
  margin: 0;
  font-size: 0.9rem;
  min-width: 0;
  word-break: break-word;
}

.client-contact-card {
  position: relative;
  background: var(--tblr-bg-surface, #fff);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  padding: 1.15rem;
  height: 100%;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.client-contact-card:hover {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.client-contact-primary {
  border-color: rgba(99, 102, 241, 0.35);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
}

.client-contact-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-indigo, #6366f1);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
}

.client-contact-channels {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.client-channel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--tblr-secondary);
  text-decoration: none;
}

.client-channel:hover {
  color: var(--tblr-primary);
}

.client-channel i {
  width: 1rem;
  flex-shrink: 0;
}

.client-contact-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.client-profile-block {
  background: var(--tblr-bg-surface-secondary, #f8fafc);
  border-radius: 0.75rem;
  padding: 1.15rem;
  border: 1px solid rgba(148, 163, 184, 0.12);
  height: 100%;
}

[data-bs-theme="dark"] .client-profile-block {
  background: rgba(15, 23, 42, 0.35);
}

.client-profile-block-head {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.client-profile-block-head i {
  margin-right: 0.35rem;
  opacity: 0.65;
}

.client-kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.client-kv-full {
  grid-column: 1 / -1;
}

.client-kv-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-secondary);
  margin-bottom: 0.2rem;
}

.client-kv-value {
  font-size: 0.9rem;
  font-weight: 500;
}

.client-gst-chip {
  background: var(--tblr-bg-surface, #fff);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
}

.client-gst-primary {
  border-color: rgba(99, 102, 241, 0.3);
}

.client-address-card {
  background: var(--tblr-bg-surface, #fff);
  border-radius: 0.5rem;
  padding: 0.75rem;
  height: 100%;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.client-address-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--tblr-secondary);
  margin-bottom: 0.5rem;
}

.client-address-body {
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 575.98px) {
  .client-kv-grid {
    grid-template-columns: 1fr;
  }

  .client-snap-pills {
    flex-direction: column;
  }

  .client-snap-pill {
    justify-content: center;
  }
}

/* ── Shared design tokens (staff + portal) ─────────────────── */
:root {
  --crm-space-1: 0.25rem;
  --crm-space-2: 0.5rem;
  --crm-space-3: 0.75rem;
  --crm-space-4: 1rem;
  --crm-radius: 0.5rem;
  --crm-icon-sm: 1rem;
  --crm-icon-md: 1.25rem;
  --crm-icon-lg: 1.5rem;
  --crm-control-h: 2rem;
  --crm-page-header-icon: 1.25rem;
}

.page-header .page-title .ti,
.page-header .page-title .icon {
  width: var(--crm-page-header-icon);
  height: var(--crm-page-header-icon);
  font-size: var(--crm-page-header-icon);
}

.btn .ti { font-size: 1rem; vertical-align: -0.1em; }
.btn-sm .ti { font-size: 0.875rem; }
.kpi-chip .ti, .stat-tile .ti { font-size: var(--crm-icon-md); }

/* Header appearance */
body.header-style-brand .navbar-brand-text,
body.header-style-brand .page-pretitle { color: var(--tblr-primary) !important; }
body.header-density-compact .navbar { min-height: 2.75rem; }
body.header-density-compact .navbar .nav-link { padding-top: 0.35rem; padding-bottom: 0.35rem; }
body.header-density-comfortable .navbar { min-height: 3.5rem; }

/* App footer */
.app-footer {
  border-top: 1px solid var(--tblr-border-color);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--tblr-secondary);
  background: var(--tblr-bg-surface);
}

/* Global search — desktop pill + mobile overlay */
.global-search-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.375rem;
  padding: 0.2rem 0.55rem 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--tblr-bg-surface-secondary, var(--tblr-bg-surface));
  border: 1px solid var(--tblr-border-color);
  transition: border-color .15s, box-shadow .15s;
}
.global-search-pill:focus-within {
  border-color: var(--tblr-primary);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--tblr-primary) 18%, transparent);
  background: var(--tblr-bg-surface);
}
.global-search-icon {
  color: var(--tblr-secondary);
  display: inline-flex;
  flex-shrink: 0;
  font-size: 1.05rem;
  line-height: 1;
}
.global-search-input,
.global-search-pill .global-search-input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.35rem 0 !important;
  height: auto !important;
  min-height: 0 !important;
  font-size: 0.875rem;
  flex: 1 1 auto;
  min-width: 0;
}
.global-search-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-left: 0.15rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.375rem;
  border: 1px solid var(--tblr-border-color);
  background: var(--tblr-bg-surface);
  color: var(--tblr-secondary);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.global-search-shortcut kbd {
  all: unset;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--tblr-secondary);
}
.global-search-shortcut-plus {
  font-size: 0.625rem;
  opacity: 0.7;
}
@media (max-width: 1199.98px) {
  .global-search-shortcut { display: none; }
}
.global-search-dropdown {
  max-height: min(70vh, 28rem);
  overflow: auto;
  border-radius: var(--crm-radius, 0.5rem);
}
.global-search-item .avatar,
.global-search-item-icon {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.875rem;
}
.global-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
}
.global-search-overlay.d-none { display: none !important; }
.global-search-overlay:not(.d-none) { display: block; }
.global-search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.global-search-overlay-panel {
  position: relative;
  z-index: 1;
  background: var(--tblr-bg-surface);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.global-search-overlay-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--tblr-border-color);
}
.global-search-overlay-bar .form-control {
  border: 0;
  box-shadow: none;
  flex: 1;
}
.global-search-overlay-results {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0;
}
body.global-search-open { overflow: hidden; }

/* Topbar icon buttons (search / theme / bell / quick-add) */
.topbar-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--tblr-secondary);
  text-decoration: none;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.topbar-icon-btn:hover,
.topbar-icon-btn:focus-visible {
  background: var(--tblr-bg-surface-secondary, rgba(0,0,0,.04));
  color: var(--tblr-body-color);
  text-decoration: none;
}
.topbar-icon-btn .ti {
  font-size: 1.35rem;
  line-height: 1;
}
.topbar-bell-badge {
  position: absolute;
  top: 0.2rem;
  right: 0.15rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #d63939;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
  border: 2px solid var(--tblr-bg-surface, #fff);
  box-sizing: content-box;
}
body.header-style-contrast .topbar-icon-btn { color: #e2e8f0; }
body.header-style-contrast .topbar-icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
body.header-style-contrast .topbar-bell-badge { border-color: #0f172a; }

/* Module KPI cards */
.module-kpi-card .avatar {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.1rem;
}
.module-kpi-card .h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.module-kpi-cards .card-link-pop:hover { transform: translateY(-1px); }

/* Perfex-style pagination */
.perfex-pagination .pagination { margin-bottom: 0; }
@media (max-width: 575.98px) {
  .perfex-pagination {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .perfex-pagination-links .pagination { justify-content: center; }
}

/* List filters / status chrome */
.list-filters .form-label { margin-bottom: 0.15rem; }
.status-chrome { scrollbar-width: thin; }
.status-chrome::-webkit-scrollbar { height: 4px; }
