/*
 * app.css — Supplementary Tailwind v4 utilities
 * The Metronic styles.css is a JIT build that only includes utilities
 * used in the Metronic demo pages.  This file adds the missing utilities
 * needed by the LGU Portal views.
 *
 * Organised by category.  Uses @layer utilities so they compose with the
 * Metronic-generated Tailwind CSS (which also uses @layer utilities).
 */

@layer utilities {

  /* ── Display / Visibility ─────────────────────── */
  .hidden   { display: none; }
  .block    { display: block; }
  .inline   { display: inline; }
  .inline-flex { display: inline-flex; }
  .grid     { display: grid; }

  /* ── Text Decoration ──────────────────────────── */
  .no-underline     { text-decoration: none; }
  .underline        { text-decoration: underline; }

  /* ── Flexbox ──────────────────────────────────── */
  .flex        { display: flex; }
  .flex-1      { flex: 1 1 0%; }
  .flex-col    { flex-direction: column; }
  .flex-wrap   { flex-wrap: wrap; }
  .grow        { flex-grow: 1; }
  .shrink-0    { flex-shrink: 0; }
  .items-center  { align-items: center; }
  .items-start   { align-items: flex-start; }
  .items-end     { align-items: flex-end; }
  .items-stretch { align-items: stretch; }
  .justify-center  { justify-content: center; }
  .justify-between { justify-content: space-between; }
  .justify-end     { justify-content: flex-end; }

  /* ── Grid ─────────────────────────────────────── */
  .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-\[minmax\(120px\2c auto\)_1fr\] { grid-template-columns: minmax(120px,auto) 1fr; }
  .grid-cols-\[minmax\(140px\2c auto\)_1fr\] { grid-template-columns: minmax(140px,auto) 1fr; }

  /* ── Sizing ───────────────────────────────────── */
  .w-full    { width: 100%; }
  .w-40      { width: 10rem; }
  .w-\[80px\]  { width: 80px; }
  .w-\[120px\] { width: 120px; }
  .h-full    { height: 100%; }
  .h-\[70px\]  { height: 70px; }
  .min-h-screen  { min-height: 100vh; }
  .max-w-md  { max-width: 28rem; }
  .max-w-xl  { max-width: 36rem; }
  .max-w-2xl { max-width: 42rem; }
  .max-w-3xl { max-width: 48rem; }
  .max-w-\[140px\] { max-width: 140px; }
  .max-w-\[440px\] { max-width: 440px; }
  .max-h-\[90vh\]  { max-height: 90vh; }

  /* ── Spacing: Padding ─────────────────────────── */
  .p-1   { padding: 0.25rem; }
  .p-2   { padding: 0.5rem; }
  .p-3   { padding: 0.75rem; }
  .p-3\.5 { padding: 0.875rem; }
  .p-4   { padding: 1rem; }
  .p-5   { padding: 1.25rem; }
  .p-10  { padding: 2.5rem; }
  .px-2\.5 { padding-inline: 0.625rem; }
  .px-3  { padding-inline: 0.75rem; }
  .px-3\.5 { padding-inline: 0.875rem; }
  .px-4  { padding-inline: 1rem; }
  .px-5  { padding-inline: 1.25rem; }
  .py-0\.5 { padding-block: 0.125rem; }
  .py-1  { padding-block: 0.25rem; }
  .py-2  { padding-block: 0.5rem; }
  .py-2\.5 { padding-block: 0.625rem; }
  .py-3  { padding-block: 0.75rem; }
  .py-4  { padding-block: 1rem; }
  .py-5  { padding-block: 1.25rem; }
  .py-6  { padding-block: 1.5rem; }
  .py-10 { padding-block: 2.5rem; }
  .py-12 { padding-block: 3rem; }
  .pt-2  { padding-top: 0.5rem; }
  .pt-2\.5 { padding-top: 0.625rem; }
  .pt-3  { padding-top: 0.75rem; }
  .pt-5  { padding-top: 1.25rem; }
  .pb-1  { padding-bottom: 0.25rem; }
  .pb-3  { padding-bottom: 0.75rem; }
  .pb-4  { padding-bottom: 1rem; }

  /* ── Spacing: Margin ──────────────────────────── */
  .m-0   { margin: 0; }
  .mx-auto { margin-inline: auto; }
  .my-0  { margin-block: 0; }
  .my-1  { margin-block: 0.25rem; }
  .my-2  { margin-block: 0.5rem; }
  .my-5  { margin-block: 1.25rem; }
  .my-8  { margin-block: 2rem; }
  .mt-0  { margin-top: 0; }
  .mt-0\.5 { margin-top: 0.125rem; }
  .mt-1  { margin-top: 0.25rem; }
  .mt-1\.5 { margin-top: 0.375rem; }
  .mt-2  { margin-top: 0.5rem; }
  .mt-3  { margin-top: 0.75rem; }
  .mt-4  { margin-top: 1rem; }
  .mt-5  { margin-top: 1.25rem; }
  .mt-6  { margin-top: 1.5rem; }
  .mb-0  { margin-bottom: 0; }
  .mb-1  { margin-bottom: 0.25rem; }
  .mb-2  { margin-bottom: 0.5rem; }
  .mb-3  { margin-bottom: 0.75rem; }
  .mb-3\.5 { margin-bottom: 0.875rem; }
  .mb-4  { margin-bottom: 1rem; }
  .mb-5  { margin-bottom: 1.25rem; }
  .mb-6  { margin-bottom: 1.5rem; }
  .mb-7  { margin-bottom: 1.75rem; }
  .mb-8  { margin-bottom: 2rem; }
  .mb-10 { margin-bottom: 2.5rem; }
  .me-1  { margin-inline-end: 0.25rem; }
  .me-2  { margin-inline-end: 0.5rem; }
  .me-3  { margin-inline-end: 0.75rem; }
  .me-4  { margin-inline-end: 1rem; }
  .ms-2  { margin-inline-start: 0.5rem; }
  .ms-auto { margin-inline-start: auto; }

  /* ── Gap ──────────────────────────────────────── */
  .gap-0\.5 { gap: 0.125rem; }
  .gap-1    { gap: 0.25rem; }
  .gap-1\.5 { gap: 0.375rem; }
  .gap-2    { gap: 0.5rem; }
  .gap-2\.5 { gap: 0.625rem; }
  .gap-3    { gap: 0.75rem; }
  .gap-4    { gap: 1rem; }
  .gap-5    { gap: 1.25rem; }
  .gap-6    { gap: 1.5rem; }
  .gap-x-4  { column-gap: 1rem; }
  .gap-y-3  { row-gap: 0.75rem; }
  .gap-y-4  { row-gap: 1rem; }

  /* ── Typography ───────────────────────────────── */
  .text-xs   { font-size: 0.75rem;  line-height: 1rem; }
  .text-sm   { font-size: 0.875rem; line-height: 1.25rem; }
  .text-base { font-size: 1rem;     line-height: 1.5rem; }
  .text-lg   { font-size: 1.125rem; line-height: 1.75rem; }
  .text-xl   { font-size: 1.25rem;  line-height: 1.75rem; }
  .text-2xl  { font-size: 1.5rem;   line-height: 2rem; }
  .text-3xl  { font-size: 1.875rem; line-height: 2.25rem; }
  .text-4xl  { font-size: 2.25rem;  line-height: 2.5rem; }
  .text-6xl  { font-size: 3.75rem;  line-height: 1; }
  .text-7xl  { font-size: 4.5rem;   line-height: 1; }
  .text-\[0\.6875rem\] { font-size: 0.6875rem; }

  .font-medium   { font-weight: 500; }
  .font-semibold { font-weight: 600; }
  .font-bold     { font-weight: 700; }
  .font-extrabold { font-weight: 800; }

  .tracking-wider { letter-spacing: 0.05em; }
  .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .text-left   { text-align: left; }
  .text-center { text-align: center; }
  .text-right  { text-align: right; }
  .text-end    { text-align: end; }

  /* ── Text Colors ──────────────────────────────── */
  .text-white      { color: #fff; }
  .text-white\/60  { color: rgb(255 255 255 / .6); }
  .text-white\/70  { color: rgb(255 255 255 / .7); }
  .text-white\/80  { color: rgb(255 255 255 / .8); }
  .text-gray-300   { color: #d1d5db; }
  .text-gray-400   { color: #9ca3af; }
  .text-gray-500   { color: #6b7280; }
  .text-gray-600   { color: #4b5563; }
  .text-gray-700   { color: #374151; }
  .text-gray-800   { color: #1f2937; }
  .text-red-500    { color: #ef4444; }
  .text-red-700    { color: #b91c1c; }
  .text-green-500  { color: #22c55e; }
  .text-green-600  { color: #16a34a; }
  .text-blue-700   { color: #1d4ed8; }
  .text-amber-500  { color: #f59e0b; }
  .text-cyan-500   { color: #06b6d4; }

  /* ── Background Colors ────────────────────────── */
  .bg-white       { background-color: #fff; }
  .bg-white\/10   { background-color: rgb(255 255 255 / .1); }
  .bg-black\/50   { background-color: rgb(0 0 0 / .5); }
  .bg-gray-50     { background-color: #f9fafb; }
  .bg-red-50      { background-color: #fef2f2; }
  .bg-blue-50     { background-color: #eff6ff; }
  .bg-green-50    { background-color: #f0fdf4; }
  .bg-amber-50    { background-color: #fffbeb; }
  .bg-cyan-50     { background-color: #ecfeff; }
  .bg-purple-subtle { background-color: #f5f3ff; }
  .bg-\[\#1c2434\]  { background-color: #1c2434; }

  /* ── Border Colors ────────────────────────────── */
  .border         { border-width: 1px; border-style: solid; }
  .border-0       { border-width: 0; }
  .border-2       { border-width: 2px; }
  .border-b       { border-bottom-width: 1px; border-bottom-style: solid; }
  .border-b-2     { border-bottom-width: 2px; border-bottom-style: solid; }
  .border-l-4     { border-left-width: 4px; border-left-style: solid; }
  .border-r-0     { border-right-width: 0; }
  .border-l-0     { border-left-width: 0; }
  .border-transparent { border-color: transparent; }
  .border-gray-100 { border-color: #f3f4f6; }
  .border-gray-200 { border-color: #e5e7eb; }
  .border-gray-300 { border-color: #d1d5db; }
  .border-red-200  { border-color: #fecaca; }
  .border-blue-200 { border-color: #bfdbfe; }
  .border-white\/25 { border-color: rgb(255 255 255 / .25); }
  .border-l-amber-400 { border-left-color: #fbbf24; }
  .border-l-cyan-400  { border-left-color: #22d3ee; }
  .border-l-green-400 { border-left-color: #4ade80; }
  .border-l-red-400   { border-left-color: #f87171; }

  /* ── Border Radius ────────────────────────────── */
  .rounded     { border-radius: 0.25rem; }
  .rounded-md  { border-radius: 0.375rem; }
  .rounded-lg  { border-radius: 0.5rem; }
  .rounded-xl  { border-radius: 0.75rem; }
  .rounded-full { border-radius: 9999px; }
  .rounded-l-lg { border-top-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem; }
  .rounded-r-lg { border-top-right-radius: 0.5rem; border-bottom-right-radius: 0.5rem; }
  .\!rounded-l-none { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
  .\!rounded-none   { border-radius: 0 !important; }

  /* ── Shadows ──────────────────────────────────── */
  .shadow     { box-shadow: 0 1px 3px rgb(0 0 0 / .1), 0 1px 2px rgb(0 0 0 / .06); }
  .shadow-sm  { box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
  .shadow-md  { box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); }
  .shadow-xl  { box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); }

  /* ── Overflow ─────────────────────────────────── */
  .overflow-auto   { overflow: auto; }
  .overflow-x-auto { overflow-x: auto; }
  .overflow-y-auto { overflow-y: auto; }

  /* ── Position ─────────────────────────────────── */
  .relative { position: relative; }
  .absolute { position: absolute; }
  .fixed    { position: fixed; }
  .sticky   { position: sticky; }
  .inset-0  { inset: 0; }
  .top-0    { top: 0; }
  .bottom-0 { bottom: 0; }
  .z-10     { z-index: 10; }
  .z-20     { z-index: 20; }
  .z-50     { z-index: 50; }

  /* ── Cursor / Interaction ─────────────────────── */
  .cursor-pointer    { cursor: pointer; }
  .transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; transition-timing-function: ease-in-out; }
  .transition-shadow { transition-property: box-shadow; transition-duration: 150ms; transition-timing-function: ease-in-out; }
  .transition-transform { transition-property: transform; transition-duration: 150ms; transition-timing-function: ease-in-out; }

  /* ── Important overrides ──────────────────────── */
  .\!p-0 { padding: 0 !important; }
  .\!m-0 { margin: 0 !important; }

  /* ── Hover States ─────────────────────────────── */
  .hover\:bg-gray-50:hover   { background-color: #f9fafb; }
  .hover\:text-gray-700:hover { color: #374151; }
  .hover\:text-white:hover    { color: #fff; }
  .hover\:text-danger:hover   { color: var(--tw-danger, #ef4444); }
  .hover\:text-success:hover  { color: var(--tw-success, #22c55e); }
  .hover\:shadow-md:hover     { box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1); }

  /* ── Responsive: sm (≥640px) ──────────────────── */
  @media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  /* ── Responsive: md (≥768px) ──────────────────── */
  @media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }

  /* ── Responsive: lg (≥1024px) ─────────────────── */
  @media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  }
}

/* ── Metronic KT semantic color aliases ─────────── */
/* These map Metronic's semantic names used in views  */
.text-primary   { color: var(--tw-primary, #3b82f6); }
.text-success   { color: var(--tw-success, #22c55e); }
.text-danger    { color: var(--tw-danger, #ef4444); }
.text-warning   { color: var(--tw-warning, #f59e0b); }
.text-info      { color: var(--tw-info, #06b6d4); }
.text-muted     { color: var(--tw-muted, #6b7280); }
.text-purple    { color: #8b5cf6; }

.text-success\/60 { color: rgb(34 197 94 / .6); }
.text-danger\/60  { color: rgb(239 68 68 / .6); }

.bg-primary\/10   { background-color: rgb(59 130 246 / .1); }
.bg-muted\/30     { background-color: rgb(107 114 128 / .3); }

.border-primary   { border-color: var(--tw-primary, #3b82f6); }
.border-success   { border-color: var(--tw-success, #22c55e); }
.border-danger    { border-color: var(--tw-danger, #ef4444); }

/* ── Base defaults ───────────────────────────────── */
html {
  height: 100%;              /* required so body's h-full (100%) resolves to viewport */
}

*,
*::before,
*::after {
  border-color: #e5e7eb;     /* default border-color so border-b etc. show */
}

body {
  color: #1f2937;            /* default text color for good contrast */
}

/* ── Stat card icon color variants ──────────────── */
.stat-icon-amber    { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon-red      { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon-green    { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-icon-cyan     { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-icon-blue     { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon-purple   { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon-gray     { background: linear-gradient(135deg, #6b7280, #4b5563); }

/* ── Table base styles ──────────────────────────── */
.table-auto  { table-layout: auto; }
.table-fixed { table-layout: fixed; }
table       { border-collapse: collapse; }
table th    { text-align: inherit; }

/* ── card component ─────────────────────────────── */
.card {
  background-color: #fff;
  border-radius: 0.75rem;
  border: 1px solid rgba(0, 0, 0, .05);
  box-shadow: 0 1px 3px rgb(0 0 0 / .08), 0 4px 12px rgb(0 0 0 / .04);
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover {
  box-shadow: 0 4px 12px rgb(0 0 0 / .1), 0 8px 24px rgb(0 0 0 / .06);
}
a.card:hover {
  transform: translateY(-2px);
}
.card-body {
  padding: 1.25rem 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}
.card-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid #e5e7eb;
}
.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

/* ── Stat card (summary cards like Pasig PMS) ───── */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-card-icon i {
  font-size: 1.25rem;
  color: #fff;
}
.stat-card-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #6b7280;
}
.stat-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

/* ── Page header / breadcrumb ───────────────────── */
.page-header {
  margin-bottom: 1.5rem;
}
.page-header h1,
.page-header h2,
.page-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.25rem;
}
.page-header .breadcrumb {
  font-size: 0.8125rem;
  color: #6b7280;
}

/* ── Quick-action grid card ─────────────────────── */
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  text-decoration: none;
  color: #1f2937;
  border: 1px dashed #d1d5db;
  border-radius: 0.75rem;
  background: #fff;
  transition: all .2s ease;
}
.action-card:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgb(59 130 246 / .12);
}
.action-card i {
  font-size: 1.5rem;
}
.action-card span {
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ── Sidebar Layout ──────────────────────────── */
/* Flex children default to min-height:auto which prevents overflow
   scrolling — reset to 0 so #scrollable_content can scroll. */
body > div,
body > div > div,
.content-panel {
  min-height: 0;
}

.content-panel {
  margin-inline-start: var(--sidebar-width);
  border-top-left-radius: calc(var(--radius) + 4px);
  border-bottom-left-radius: calc(var(--radius) + 4px);
  transition: margin-inline-start .25s ease;
}

/* ── Sidebar Collapse ───────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  transition: width .25s ease;
  overflow: hidden;
}
.sidebar-transition { transition: width .25s ease; }

/* Toggle button */
.sidebar-toggle-btn {
  flex-shrink: 0;
  background: none;
  border: none;
}
.sidebar-toggle-icon {
  transition: transform .25s ease;
}

/* Collapsed state */
body.sidebar-collapsed {
  --sidebar-width: 70px;
}
body.sidebar-collapsed #sidebar {
  width: 70px;
}
body.sidebar-collapsed .content-panel {
  margin-inline-start: 70px;
}

/* Hide text labels when collapsed */
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .kt-menu-title {
  display: none;
}

/* Center icons in collapsed mode */
body.sidebar-collapsed .kt-menu-link {
  justify-content: center;
  padding-inline: 0;
}
body.sidebar-collapsed .kt-menu-icon {
  font-size: 1.125rem;
}

/* Flip toggle icon */
body.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

/* Center sidebar header in collapsed mode */
body.sidebar-collapsed #sidebar_header .flex {
  justify-content: center;
  padding-inline: 0.5rem;
  flex-wrap: wrap;
}
body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
}
body.sidebar-collapsed .sidebar-icon-fixed {
  margin: 0;
}

/* Hide notification bell in collapsed sidebar — dropdown can't display at 70px */
body.sidebar-collapsed #notificationBellWrapper {
  display: none;
}

/* Keep toggle button visible and centered */
body.sidebar-collapsed .sidebar-toggle-btn {
  margin: 0 auto;
}

/* Center sidebar footer in collapsed mode */
body.sidebar-collapsed #sidebar_footer {
  justify-content: center;
  padding-inline: 0.5rem;
}

/* Tooltip on hover for collapsed menu items */
body.sidebar-collapsed .kt-menu-item {
  position: relative;
}
body.sidebar-collapsed .kt-menu-item .kt-menu-link[title]:hover::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  background: #1f2937;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

/* Profile link in sidebar footer */
.sidebar-profile-link {
  text-decoration: none;
  border-radius: 0.375rem;
  padding: 0.25rem;
  margin: -0.25rem;
  transition: background-color .15s ease;
}
.sidebar-profile-link:hover {
  background-color: rgba(255,255,255,.1);
}
.sidebar-profile-link:hover .text-white\/80 {
  color: #fff;
}

/* ── Section panel (Recent Projects / Departments) ─ */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}
.panel-header h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}
.panel-header .view-all {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  transition: all .15s ease;
}
.panel-header .view-all:hover {
  background: #f3f4f6;
  color: #374151;
}

/* ═══════════════════════════════════════════════════════════════════
 * Bootstrap 5 Compatibility Layer
 * ─────────────────────────────────────────────────────────────────
 * Metronic v9 Tailwind does not ship Bootstrap's grid, form, button
 * or display utilities.  The rules below provide the subset used by
 * the LGU Portal views so layouts render correctly.
 * ═══════════════════════════════════════════════════════════════════ */

/* ── BS5 Grid System ────────────────────────────────────────────── */
.row {
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--bs-gutter-y));
  margin-right: calc(-.5 * var(--bs-gutter-x));
  margin-left: calc(-.5 * var(--bs-gutter-x));
}
.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: calc(var(--bs-gutter-x) * .5);
  padding-left: calc(var(--bs-gutter-x) * .5);
  margin-top: var(--bs-gutter-y);
}

/* gutter overrides */
.g-0 { --bs-gutter-x: 0; --bs-gutter-y: 0; }
.g-1 { --bs-gutter-x: 0.25rem; --bs-gutter-y: 0.25rem; }
.g-2 { --bs-gutter-x: 0.5rem;  --bs-gutter-y: 0.5rem; }
.g-3 { --bs-gutter-x: 1rem;    --bs-gutter-y: 1rem; }
.g-4 { --bs-gutter-x: 1.5rem;  --bs-gutter-y: 1.5rem; }
.g-5 { --bs-gutter-x: 3rem;    --bs-gutter-y: 3rem; }

/* column – default (xs, no breakpoint) */
.col    { flex: 1 0 0%; }
.col-1  { flex: 0 0 auto; width: 8.333333%; }
.col-2  { flex: 0 0 auto; width: 16.666667%; }
.col-3  { flex: 0 0 auto; width: 25%; }
.col-4  { flex: 0 0 auto; width: 33.333333%; }
.col-5  { flex: 0 0 auto; width: 41.666667%; }
.col-6  { flex: 0 0 auto; width: 50%; }
.col-7  { flex: 0 0 auto; width: 58.333333%; }
.col-8  { flex: 0 0 auto; width: 66.666667%; }
.col-9  { flex: 0 0 auto; width: 75%; }
.col-10 { flex: 0 0 auto; width: 83.333333%; }
.col-11 { flex: 0 0 auto; width: 91.666667%; }
.col-12 { flex: 0 0 auto; width: 100%; }

/* sm ≥ 576px */
@media (min-width: 576px) {
  .col-sm-1  { flex: 0 0 auto; width: 8.333333%; }
  .col-sm-2  { flex: 0 0 auto; width: 16.666667%; }
  .col-sm-3  { flex: 0 0 auto; width: 25%; }
  .col-sm-4  { flex: 0 0 auto; width: 33.333333%; }
  .col-sm-5  { flex: 0 0 auto; width: 41.666667%; }
  .col-sm-6  { flex: 0 0 auto; width: 50%; }
  .col-sm-7  { flex: 0 0 auto; width: 58.333333%; }
  .col-sm-8  { flex: 0 0 auto; width: 66.666667%; }
  .col-sm-9  { flex: 0 0 auto; width: 75%; }
  .col-sm-10 { flex: 0 0 auto; width: 83.333333%; }
  .col-sm-11 { flex: 0 0 auto; width: 91.666667%; }
  .col-sm-12 { flex: 0 0 auto; width: 100%; }
}

/* md ≥ 768px */
@media (min-width: 768px) {
  .col-md-1  { flex: 0 0 auto; width: 8.333333%; }
  .col-md-2  { flex: 0 0 auto; width: 16.666667%; }
  .col-md-3  { flex: 0 0 auto; width: 25%; }
  .col-md-4  { flex: 0 0 auto; width: 33.333333%; }
  .col-md-5  { flex: 0 0 auto; width: 41.666667%; }
  .col-md-6  { flex: 0 0 auto; width: 50%; }
  .col-md-7  { flex: 0 0 auto; width: 58.333333%; }
  .col-md-8  { flex: 0 0 auto; width: 66.666667%; }
  .col-md-9  { flex: 0 0 auto; width: 75%; }
  .col-md-10 { flex: 0 0 auto; width: 83.333333%; }
  .col-md-11 { flex: 0 0 auto; width: 91.666667%; }
  .col-md-12 { flex: 0 0 auto; width: 100%; }
}

/* lg ≥ 992px */
@media (min-width: 992px) {
  .col-lg-1  { flex: 0 0 auto; width: 8.333333%; }
  .col-lg-2  { flex: 0 0 auto; width: 16.666667%; }
  .col-lg-3  { flex: 0 0 auto; width: 25%; }
  .col-lg-4  { flex: 0 0 auto; width: 33.333333%; }
  .col-lg-5  { flex: 0 0 auto; width: 41.666667%; }
  .col-lg-6  { flex: 0 0 auto; width: 50%; }
  .col-lg-7  { flex: 0 0 auto; width: 58.333333%; }
  .col-lg-8  { flex: 0 0 auto; width: 66.666667%; }
  .col-lg-9  { flex: 0 0 auto; width: 75%; }
  .col-lg-10 { flex: 0 0 auto; width: 83.333333%; }
  .col-lg-11 { flex: 0 0 auto; width: 91.666667%; }
  .col-lg-12 { flex: 0 0 auto; width: 100%; }
}

/* xl ≥ 1200px */
@media (min-width: 1200px) {
  .col-xl-1  { flex: 0 0 auto; width: 8.333333%; }
  .col-xl-2  { flex: 0 0 auto; width: 16.666667%; }
  .col-xl-3  { flex: 0 0 auto; width: 25%; }
  .col-xl-4  { flex: 0 0 auto; width: 33.333333%; }
  .col-xl-5  { flex: 0 0 auto; width: 41.666667%; }
  .col-xl-6  { flex: 0 0 auto; width: 50%; }
  .col-xl-7  { flex: 0 0 auto; width: 58.333333%; }
  .col-xl-8  { flex: 0 0 auto; width: 66.666667%; }
  .col-xl-9  { flex: 0 0 auto; width: 75%; }
  .col-xl-10 { flex: 0 0 auto; width: 83.333333%; }
  .col-xl-11 { flex: 0 0 auto; width: 91.666667%; }
  .col-xl-12 { flex: 0 0 auto; width: 100%; }
}

/* ── BS5 Collapse ───────────────────────────────────────────────── */
/* Override Tailwind's .collapse { visibility: collapse } */
.collapse:not(.show) {
  display: none !important;
  visibility: visible !important;
}
.collapse.show {
  display: block !important;
  visibility: visible !important;
}
.collapsing {
  height: 0;
  overflow: hidden;
  transition: height .35s ease;
  visibility: visible !important;
}

/* ── BS5 Display Utilities ──────────────────────────────────────── */
.d-none        { display: none !important; }
.d-inline      { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block       { display: block !important; }
.d-flex        { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

/* ── BS5 Flex Utilities ─────────────────────────────────────────── */
.flex-row            { flex-direction: row !important; }
.flex-column         { flex-direction: column !important; }
.flex-wrap           { flex-wrap: wrap !important; }
.flex-nowrap         { flex-wrap: nowrap !important; }
.flex-grow-1         { flex-grow: 1 !important; }
.flex-shrink-0       { flex-shrink: 0 !important; }
.justify-content-start   { justify-content: flex-start !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around  { justify-content: space-around !important; }
.align-items-start   { align-items: flex-start !important; }
.align-items-end     { align-items: flex-end !important; }
.align-items-center  { align-items: center !important; }
.align-items-stretch { align-items: stretch !important; }
.align-self-start    { align-self: flex-start !important; }
.align-self-end      { align-self: flex-end !important; }
.align-self-center   { align-self: center !important; }

/* ── BS5 Gap Utilities ──────────────────────────────────────────── */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* ── BS5 Form Controls ─────────────────────────────────────────── */
.form-label {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: #1f2937;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  appearance: none;
}
.form-control:focus {
  border-color: #93c5fd;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, .25);
}
.form-control::placeholder {
  color: #9ca3af;
  opacity: 1;
}
.form-control:disabled,
.form-control[readonly] {
  background-color: #f3f4f6;
  opacity: 1;
}

.form-control-sm {
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 0.25rem;
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: #1f2937;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23374151' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  appearance: none;
}
.form-select:focus {
  border-color: #93c5fd;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, .25);
}
.form-select:disabled {
  background-color: #f3f4f6;
}

.form-select-sm {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  padding-left: 0.5rem;
  font-size: 0.8125rem;
  border-radius: 0.25rem;
}

.form-check {
  display: block;
  min-height: 1.5rem;
  padding-left: 1.5em;
  margin-bottom: 0.125rem;
}
.form-check-input {
  width: 1em;
  height: 1em;
  margin-top: 0.25em;
  margin-left: -1.5em;
  vertical-align: top;
  background-color: #fff;
  border: 1px solid #d1d5db;
  appearance: none;
}
.form-check-input[type="checkbox"] { border-radius: 0.25em; }
.form-check-input[type="radio"]    { border-radius: 50%; }
.form-check-input:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

/* ── BS5 Input Group ────────────────────────────────────────────── */
.input-group {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
}
.input-group > .form-control,
.input-group > .form-select {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
}

/* ── BS5 Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-weight: 500;
  line-height: 1.5;
  color: #374151;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.btn:hover  { opacity: 0.88; }
.btn:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, .25);
}
.btn:disabled, .btn.disabled {
  pointer-events: none;
  opacity: 0.65;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: 0.25rem;
}
.btn-lg {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 0.5rem;
}

.btn-primary {
  color: #fff;
  background-color: #3b82f6;
  border-color: #3b82f6;
}
.btn-primary:hover { background-color: #2563eb; border-color: #2563eb; }

.btn-secondary {
  color: #fff;
  background-color: #6b7280;
  border-color: #6b7280;
}
.btn-secondary:hover { background-color: #4b5563; border-color: #4b5563; }

.btn-success {
  color: #fff;
  background-color: #22c55e;
  border-color: #22c55e;
}
.btn-success:hover { background-color: #16a34a; border-color: #16a34a; }

.btn-danger {
  color: #fff;
  background-color: #ef4444;
  border-color: #ef4444;
}
.btn-danger:hover { background-color: #dc2626; border-color: #dc2626; }

.btn-warning {
  color: #1f2937;
  background-color: #f59e0b;
  border-color: #f59e0b;
}
.btn-warning:hover { background-color: #d97706; border-color: #d97706; }

.btn-info {
  color: #fff;
  background-color: #06b6d4;
  border-color: #06b6d4;
}
.btn-info:hover { background-color: #0891b2; border-color: #0891b2; }

.btn-light {
  color: #1f2937;
  background-color: #f3f4f6;
  border-color: #e5e7eb;
}
.btn-light:hover { background-color: #e5e7eb; border-color: #d1d5db; }

.btn-outline-primary {
  color: #3b82f6;
  border-color: #3b82f6;
}
.btn-outline-primary:hover { color: #fff; background-color: #3b82f6; }

.btn-outline-secondary {
  color: #6b7280;
  border-color: #6b7280;
}
.btn-outline-secondary:hover { color: #fff; background-color: #6b7280; }

.btn-outline-danger {
  color: #ef4444;
  border-color: #ef4444;
}
.btn-outline-danger:hover { color: #fff; background-color: #ef4444; }

/* ── BS5 Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.35em 0.65em;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.375rem;
}
.bg-light-primary {
  background-color: rgba(59, 130, 246, .1) !important;
}

/* ── BS5 Typography Utilities ───────────────────────────────────── */
.fw-bold     { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium   { font-weight: 500 !important; }
.fw-normal   { font-weight: 400 !important; }
.fw-light    { font-weight: 300 !important; }
.fst-italic  { font-style: italic !important; }

.fs-1 { font-size: 2.5rem !important; }
.fs-2 { font-size: 2rem !important; }
.fs-3 { font-size: 1.75rem !important; }
.fs-4 { font-size: 1.5rem !important; }
.fs-5 { font-size: 1.25rem !important; }
.fs-6 { font-size: 1rem !important; }
.fs-7 { font-size: 0.875rem !important; }
.fs-8 { font-size: 0.8125rem !important; }

.text-nowrap { white-space: nowrap !important; }

/* ── BS5 Spacing Utilities ──────────────────────────────────────── */
/* margin-bottom (used heavily across views) */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.ms-auto { margin-inline-start: auto !important; }
.me-1 { margin-inline-end: 0.25rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.me-3 { margin-inline-end: 1rem !important; }

.my-1 { margin-top: 0.25rem !important; margin-bottom: 0.25rem !important; }

.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important;  padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important;    padding-bottom: 1rem !important; }
.py-5 { padding-top: 3rem !important;    padding-bottom: 3rem !important; }

.px-2 { padding-left: 0.5rem !important;  padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important;    padding-right: 1rem !important; }

.pt-5 { padding-top: 3rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }

.p-3  { padding: 1rem !important; }
.p-5  { padding: 3rem !important; }

/* ── BS5 Metronic Compat: Card Variants ─────────────────────────── */
.card-flush {
  box-shadow: none;
  border: 0;
}
.card-toolbar {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

/* ── BS5 Separator ──────────────────────────────────────────────── */
.separator {
  display: block;
  border-bottom: 1px solid #e5e7eb;
}
.separator.border-1 { border-bottom-width: 1px; }
.separator.border-2 { border-bottom-width: 2px; }

/* ── BS5 Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin-bottom: 0;
  list-style: none;
}
.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  padding: 0 0.5rem;
  color: #9ca3af;
}
.breadcrumb-separatorless .breadcrumb-item + .breadcrumb-item::before {
  display: none;
}

/* ── BS5 Modal (minimal, Kendo/Metronic handle the rest) ────────── */
.modal { position: fixed; inset: 0; z-index: 1055; display: none; overflow-x: hidden; overflow-y: auto; outline: 0; }
.modal.show { display: block; }
.modal-dialog { position: relative; margin: 1.75rem auto; max-width: 500px; pointer-events: none; }
.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 3.5rem); }
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1140px; }
.modal-content { position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; background-color: #fff; border-radius: 0.5rem; box-shadow: 0 10px 25px rgba(0,0,0,.15); outline: 0; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid #e5e7eb; }
.modal-body { position: relative; flex: 1 1 auto; padding: 1.5rem; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb; gap: 0.5rem; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1050; background-color: #000; }
.modal-backdrop.show { opacity: 0.5; }
.fade { transition: opacity .15s linear; }
.fade:not(.show) { opacity: 0; }

/* ── BS5 Close Button ───────────────────────────────────────────── */
.btn-close {
  box-sizing: content-box;
  width: 1em; height: 1em;
  padding: 0.25em;
  color: #000;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.5;
  cursor: pointer;
}
.btn-close:hover { opacity: 0.75; }

/* ── BS5 Table ──────────────────────────────────────────────────── */
.table {
  width: 100%;
  margin-bottom: 1rem;
  color: #1f2937;
  vertical-align: top;
  border-color: #e5e7eb;
}
.table > :not(caption) > * > * {
  padding: 0.5rem;
  border-bottom-width: 1px;
}
.table > thead { vertical-align: bottom; }

/* ── Misc Utility ───────────────────────────────────────────────── */
.col-filter-label {
  font-size: 0.8125rem;
}
.filter-label {
  font-size: 0.8125rem;
}
.text-end { text-align: end !important; }
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.pe-3 { padding-inline-end: 1rem !important; }
.border-bottom { border-bottom: 1px solid #e5e7eb !important; }
.text-decoration-none { text-decoration: none !important; }

/* ═══════════════════════════════════════════════════════════════════
 * Kendo UI Grid — Compact / Modern Overrides
 * ─────────────────────────────────────────────────────────────────
 * Applied globally so all 55+ grid pages look consistent.
 * ═══════════════════════════════════════════════════════════════════ */

.k-grid {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  font-family: inherit;
}

/* Header */
.k-grid .k-grid-header {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}
.k-grid .k-grid-header th,
.k-grid .k-grid-header .k-header {
  padding: 0.625rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-right: none;
  white-space: nowrap;
}
.k-grid .k-grid-header th .k-link {
  color: inherit;
  text-decoration: none;
}

/* Data cells */
.k-grid td {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: #374151;
  border-bottom: 1px solid #f1f5f9;
  border-right: none;
  vertical-align: middle;
  line-height: 1.4;
}
.k-grid tr:hover td {
  background-color: #f8fafc;
}
.k-grid .k-alt td {
  background-color: #fafbfc;
}
.k-grid .k-alt:hover td {
  background-color: #f1f5f9;
}

/* Selected rows */
.k-grid .k-selected td,
.k-grid .k-selected:hover td {
  background-color: #eff6ff;
}

/* Pager */
.k-grid .k-pager,
.k-grid .k-pager-wrap {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #e5e7eb;
  background: #fafbfc;
  font-size: 0.8125rem;
  color: #6b7280;
}
.k-grid .k-pager .k-link,
.k-grid .k-pager .k-pager-nav {
  min-width: 2rem;
  height: 2rem;
  border-radius: 0.25rem;
}
.k-grid .k-pager .k-link:hover,
.k-grid .k-pager .k-pager-nav:hover {
  background-color: #e5e7eb;
}
.k-grid .k-pager .k-selected,
.k-grid .k-pager .k-state-selected {
  background-color: #3b82f6;
  color: #fff;
  border-radius: 0.25rem;
}
.k-grid .k-pager .k-pager-input .k-textbox,
.k-grid .k-pager select {
  height: 2rem;
  font-size: 0.8125rem;
}

/* No-records message */
.k-grid .k-grid-norecords {
  padding: 2rem;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* ═══════════════════════════════════════════════════════════════════
 * KT Menu Dropdown (Grid Action Columns)
 * ─────────────────────────────────────────────────────────────────
 * Metronic v9 Tailwind does not include the menu-sub-dropdown
 * component.  These styles replicate the action dropdown used in
 * 55+ Kendo Grid pages across all areas.
 * ═══════════════════════════════════════════════════════════════════ */

/* Action trigger button */
.btn-active-light-primary:hover {
  background-color: #eff6ff;
  color: #2563eb;
}

/* Dropdown container — hidden by default */
.menu-sub-dropdown,
.menu.menu-sub {
  display: none;
  position: absolute;
  z-index: 1075;
  min-width: 10rem;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
  padding: 0.5rem 0;
}
.menu-sub-dropdown.show,
.menu.menu-sub.show {
  display: block;
}

/* Menu items */
.menu-item .menu-link {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease;
  white-space: nowrap;
}
.menu-item .menu-link:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}
.menu-item .menu-link i {
  width: 1.25rem;
  text-align: center;
}

/* Grid cell hosting the action trigger needs relative positioning */
.k-grid td:has([data-kt-menu-trigger]) {
  position: relative;
  overflow: visible;
}

/* ===================================================================
   AI Assistant Floating Chat Widget
   =================================================================== */
.ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
}

/* Floating Action Button */
.ai-chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(102, 126, 234, .4);
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(102, 126, 234, .55);
}

/* Chat Panel */
.ai-chat-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aiSlideUp .25s ease;
}

@keyframes aiSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
.ai-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
}
.ai-chat-header-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  transition: color .15s;
}
.ai-chat-header-btn:hover {
  color: #fff;
}

/* Messages area */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
  max-height: 380px;
  background: #f9fafb;
}

/* Message rows */
.ai-msg {
  display: flex;
  flex-direction: column;
}
.ai-msg-user {
  align-items: flex-end;
}
.ai-msg-assistant {
  align-items: flex-start;
}

/* Bubbles */
.ai-msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg-assistant .ai-msg-bubble {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.ai-typing-dots {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.ai-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: aiDotPulse .8s ease-in-out infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: .15s; }
.ai-typing-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes aiDotPulse {
  0%, 80%, 100% { opacity: .3; transform: scale(.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Input area */
.ai-chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.ai-chat-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  background: #f9fafb;
  transition: border-color .15s;
}
.ai-chat-input input:focus {
  border-color: #667eea;
}
.ai-chat-input button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s;
}
.ai-chat-input button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Responsive: smaller screens */
@media (max-width: 480px) {
  .ai-chat-panel {
    width: calc(100vw - 32px);
    right: -8px;
    max-height: 70vh;
  }
}

/* ===================================================================
   AI Dashboard Insights Card
   =================================================================== */
.ai-insights-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
}
.ai-insights-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, rgba(102,126,234,.08) 0%, rgba(118,75,162,.06) 100%);
}
.ai-insights-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: #374151;
}
.ai-insights-title i {
  color: #667eea;
  font-size: 18px;
}
.ai-insights-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.ai-insights-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}
.ai-insights-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.ai-insights-body {
  padding: 20px;
}
.ai-insights-loading {
  display: flex;
  align-items: center;
  padding: 8px 0;
}
.ai-insights-content {
  font-size: 14px;
  line-height: 1.7;
  color: #374151;
}
.ai-insights-content p {
  margin: 0 0 10px;
}
.ai-insights-content strong {
  color: #1f2937;
}
.ai-insights-content ul {
  margin: 4px 0 10px 0;
  padding-left: 0;
  list-style: none;
}
.ai-insights-content ul li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 4px;
}
.ai-insights-content ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #667eea;
  font-weight: bold;
}

/* ─── AI Data Query (NLQ) Panel ───────────────────────────────── */
.ai-data-query-panel {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  margin-bottom: 24px;
}
.ai-dq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
.ai-dq-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
}
.ai-dq-badge {
  font-size: 10px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
.ai-dq-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ai-dq-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.ai-dq-body {
  padding: 20px;
}
.ai-dq-description p {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 12px;
}
.ai-dq-examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.ai-dq-examples-label {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
}
.ai-dq-example-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-dq-example-btn:hover {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}
.ai-dq-input-row {
  display: flex;
  gap: 8px;
}
.ai-dq-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.ai-dq-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.ai-dq-submit {
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-dq-submit:hover {
  opacity: 0.9;
}
.ai-dq-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ai-dq-loading {
  display: flex;
  align-items: center;
  padding: 16px 0 8px;
}
.ai-dq-results {
  margin-top: 16px;
}
.ai-dq-summary {
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  padding: 12px 16px;
  background: #f0f4ff;
  border-radius: 8px;
  border-left: 3px solid #667eea;
  margin-bottom: 12px;
}
.ai-dq-sql-wrap {
  margin-bottom: 12px;
}
.ai-dq-sql-toggle {
  font-size: 12px;
  color: #667eea;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}
.ai-dq-sql-toggle:hover {
  text-decoration: underline;
}
.ai-dq-sql {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-dq-table-wrap {
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}
.ai-dq-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ai-dq-table-wrap thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #4b5563;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.ai-dq-table-wrap tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-dq-table-wrap tbody tr:hover td {
  background: #f0f4ff;
}
.ai-dq-error {
  margin-top: 12px;
  padding: 12px 16px;
  background: #fef2f2;
  color: #dc2626;
  border-radius: 8px;
  font-size: 13px;
  border-left: 3px solid #dc2626;
}
.ai-dq-row-count {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 8px;
  text-align: right;
}

/* ─── AI Voice (TTS) Speak Buttons ─────────────────────────────── */
.ai-speak-wrap {
  display: flex;
  justify-content: flex-end;
  padding: 6px 0 2px;
}
.ai-speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s ease;
}
.ai-speak-btn:hover {
  background: #e5e7eb;
  color: #374151;
}
.ai-speak-btn.ai-speak-playing {
  background: #fef3c7;
  color: #d97706;
  border-color: #fcd34d;
}
.ai-speak-btn.ai-speak-playing:hover {
  background: #fde68a;
}
.ai-speak-btn.ai-speak-loading {
  opacity: .65;
  cursor: wait;
}
.ai-speak-btn i {
  font-size: 13px;
}

/* Inline speak button for chat bubbles */
.ai-speak-btn-inline {
  padding: 3px 7px;
  margin-top: 4px;
  font-size: 11px;
  border: none;
  background: transparent;
  color: #9ca3af;
  border-radius: 4px;
}
.ai-speak-btn-inline:hover {
  background: #f3f4f6;
  color: #6b7280;
}
.ai-speak-btn-inline.ai-speak-playing {
  background: #fef3c7;
  color: #d97706;
}
.ai-speak-btn-inline span {
  display: none; /* hide label on inline buttons */
}

/* ═══════════════════════════════════════════════════════════════
   Notification Badges
   ═══════════════════════════════════════════════════════════════ */

/* Bell badge — positioned on the notification bell icon in sidebar header */
.notification-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: #ef4444;
  border-radius: 9999px;
  pointer-events: none;
  animation: badge-pulse 2s ease-in-out infinite;
}

/* Sidebar Messages unread badge — inline pill next to "Messages" text */
.sidebar-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #ef4444;
  border-radius: 9999px;
}

/* Subtle pulse animation for the bell badge */
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Bell shake animation on new message */
@keyframes bell-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(2deg); }
}
.bell-ring {
  animation: bell-shake 0.6s ease-in-out;
}

/* Notification Dropdown Panel */
.notification-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18), 0 2px 8px rgba(0,0,0,.06);
  z-index: 9999;
  overflow: hidden;
}
.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f1f1;
}
.notification-dropdown-list {
  max-height: 320px;
  overflow-y: auto;
}
.notification-dropdown-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  color: #9ca3af;
}
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f9fafb;
}
.notification-item:hover {
  background: #f3f4f6;
}
.notification-item:last-child {
  border-bottom: none;
}
.notification-dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--kt-primary, #3b82f6);
  text-decoration: none;
  border-top: 1px solid #f1f1f1;
  transition: background 0.15s;
}
.notification-dropdown-footer:hover {
  background: #f9fafb;
  text-decoration: none;
  color: var(--kt-primary, #3b82f6);
}

/* Toast Notifications */
.notification-toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 360px;
}
.notification-toast {
  pointer-events: all;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--kt-primary, #3b82f6);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
  animation: toast-slide-in 0.3s ease-out;
  overflow: hidden;
}
.notification-toast-content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.notification-toast-close {
  background: none;
  border: none;
  color: #9ca3af;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}
.notification-toast-close:hover {
  color: #374151;
}
@keyframes toast-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.notification-toast-exit {
  animation: toast-slide-out 0.3s ease-in forwards;
}
@keyframes toast-slide-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Chat Page — Real-Time Messaging, Voice & Video Calls
   ═══════════════════════════════════════════════════════════════ */

/* Layout */
.chat-page-container { display:flex; height:calc(100vh - 200px); background:#fff; border-radius:12px; overflow:hidden; box-shadow:0 1px 8px rgba(0,0,0,.08); }
.chat-sidebar { width:380px; border-right:1px solid #e5e7eb; display:flex; flex-direction:column; overflow:hidden; background:#fafbfc; }
.chat-main { flex:1; display:flex; flex-direction:column; min-width:0; }

/* Sidebar Header */
.chat-sidebar-header { padding:16px 20px; border-bottom:1px solid #e5e7eb; display:flex; justify-content:space-between; align-items:center; }
.chat-sidebar-header h4 { margin:0; font-weight:700; font-size:18px; display:flex; align-items:center; gap:8px; }

/* Search */
.chat-search-box { padding:12px 16px; }
.chat-search-wrap { position:relative; }
.chat-search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#9ca3af; font-size:13px; }
.chat-search-wrap input { width:100%; padding:9px 12px 9px 34px; border:1px solid #e5e7eb; background:#f9fafb; border-radius:20px; font-size:14px; outline:none; transition:border-color .2s; }
.chat-search-wrap input:focus { border-color:#3b82f6; }

/* Conversations List */
.chat-conversations { flex:1; overflow-y:auto; }
.chat-conv-row { display:flex; align-items:center; padding:12px 16px; cursor:pointer; transition:background .15s; gap:12px; border-bottom:1px solid #f3f4f6; }
.chat-conv-row:hover { background:#f0f4ff; }
.chat-conv-row.chat-conv-active { background:#e0ecff; }

/* Avatar */
.chat-conv-avatar-wrap { position:relative; flex-shrink:0; }
.chat-conv-avatar { width:44px; height:44px; border-radius:50%; object-fit:cover; background:#e5e7eb; }
.chat-conv-avatar-placeholder { width:44px; height:44px; border-radius:50%; background:#e5e7eb; display:flex; align-items:center; justify-content:center; color:#9ca3af; font-size:18px; }

/* Online dot */
.chat-online-dot { position:absolute; bottom:1px; right:1px; width:11px; height:11px; border-radius:50%; background:#d1d5db; border:2px solid #fff; transition:background .2s; }
.chat-online-dot.online { background:#22c55e; }

/* Conversation info */
.chat-conv-info { flex:1; min-width:0; }
.chat-conv-name { font-weight:600; font-size:14px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-conv-preview { color:#6b7280; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-conv-meta { display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex-shrink:0; }
.chat-conv-time { font-size:11px; color:#9ca3af; }
.chat-unread-badge { display:inline-block; background:#3b82f6; color:#fff; font-size:11px; font-weight:700; min-width:20px; height:20px; border-radius:10px; text-align:center; line-height:20px; padding:0 6px; }

/* Connection Status */
.chat-connection-status { display:block; padding:4px 16px; font-size:11px; text-align:center; }

/* Main Header */
.chat-main-header { padding:12px 20px; border-bottom:1px solid #e5e7eb; display:flex; align-items:center; gap:12px; }
.chat-header-avatar { flex-shrink:0; }
.chat-header-avatar-img { width:40px; height:40px; border-radius:50%; object-fit:cover; }
.chat-header-avatar-placeholder { width:40px; height:40px; border-radius:50%; background:#e5e7eb; display:flex; align-items:center; justify-content:center; color:#9ca3af; font-size:16px; }
.chat-header-info { flex:1; min-width:0; }
.chat-header-info strong { display:block; font-size:15px; }
.chat-typing { font-size:12px; color:#3b82f6; }
.chat-call-buttons { display:flex; gap:4px; flex-shrink:0; }

/* Buttons */
.chat-btn-icon { width:36px; height:36px; border-radius:50%; border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:15px; transition:all .15s; }
.chat-btn-primary { background:#3b82f6; color:#fff; }
.chat-btn-primary:hover { background:#2563eb; }
.chat-btn-ghost { background:transparent; color:#6b7280; }
.chat-btn-ghost:hover { background:#f3f4f6; color:#1f2937; }

/* Messages Area */
.chat-message-area { flex:1; overflow-y:auto; padding:20px; display:flex; flex-direction:column; gap:6px; }
.chat-empty-messages { display:flex; flex-direction:column; align-items:center; justify-content:center; height:100%; color:#9ca3af; text-align:center; }

/* Message Bubbles */
.chat-msg { max-width:68%; display:flex; flex-direction:column; }
.chat-msg-sent { align-self:flex-end; }
.chat-msg-received { align-self:flex-start; }
.chat-msg-sender { font-size:11px; font-weight:600; color:#6b7280; margin-bottom:2px; padding-left:4px; }
.chat-msg-bubble { padding:10px 14px; border-radius:18px; font-size:14px; line-height:1.45; word-wrap:break-word; white-space:pre-wrap; }
.chat-msg-sent .chat-msg-bubble { background:#3b82f6; color:#fff; border-bottom-right-radius:4px; }
.chat-msg-received .chat-msg-bubble { background:#f0f2f5; color:#1f2937; border-bottom-left-radius:4px; }
.chat-msg-time { font-size:11px; color:#9ca3af; margin-top:2px; padding:0 4px; }
.chat-msg-sent .chat-msg-time { text-align:right; }

/* System messages (calls) */
.chat-msg-system { font-size:13px; color:#6b7280; background:#f9fafb; padding:6px 12px; border-radius:12px; display:flex; align-items:center; gap:6px; }

/* File & image messages */
.chat-msg-file a { display:flex; align-items:center; gap:6px; padding:8px 12px; background:#f3f4f6; border-radius:10px; color:#3b82f6; font-size:13px; text-decoration:none; }
.chat-msg-file a:hover { background:#e5e7eb; }
.chat-msg-image img { max-width:260px; max-height:200px; border-radius:10px; cursor:pointer; transition:opacity .2s; }
.chat-msg-image img:hover { opacity:.85; }

/* Input Area */
.chat-input-area { padding:12px 20px; border-top:1px solid #e5e7eb; display:flex; gap:8px; align-items:center; }
.chat-input-area input[type="text"] { flex:1; padding:10px 16px; border:1px solid #e5e7eb; background:#f9fafb; border-radius:20px; font-size:14px; outline:none; transition:border-color .2s; }
.chat-input-area input[type="text"]:focus { border-color:#3b82f6; }

/* ─── Modals ─── */
.chat-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; z-index:9999; }
.chat-modal { background:#fff; border-radius:14px; width:400px; max-height:80vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,.2); overflow:hidden; }
.chat-modal-header { padding:16px 20px; border-bottom:1px solid #e5e7eb; display:flex; justify-content:space-between; align-items:center; }
.chat-modal-header h5 { margin:0; font-weight:700; font-size:16px; }
.chat-modal-body { padding:16px 20px; overflow-y:auto; flex:1; }
.chat-modal-search { width:100%; padding:10px 14px; border:1px solid #e5e7eb; border-radius:10px; font-size:14px; outline:none; margin-bottom:12px; }

/* User list (new chat) */
.chat-user-list { max-height:300px; overflow-y:auto; }
.chat-user-row { display:flex; align-items:center; gap:12px; padding:10px 8px; cursor:pointer; border-radius:8px; transition:background .15s; }
.chat-user-row:hover { background:#f0f4ff; }
.chat-user-name { font-weight:500; font-size:14px; }

/* ─── Call UI ─── */
.chat-call-modal { width:360px; }
.chat-call-modal-body { padding:40px 30px; text-align:center; }
.chat-call-modal-body h4 { margin:16px 0 4px; font-size:20px; }
.chat-call-actions { display:flex; justify-content:center; gap:20px; margin-top:24px; }
.chat-btn-call { width:56px; height:56px; border-radius:50%; border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:22px; color:#fff; transition:transform .15s, box-shadow .15s; }
.chat-btn-call:hover { transform:scale(1.08); }
.chat-btn-accept { background:#22c55e; box-shadow:0 4px 12px rgba(34,197,94,.35); }
.chat-btn-reject { background:#ef4444; box-shadow:0 4px 12px rgba(239,68,68,.35); }
.chat-btn-call-ctrl { background:#374151; box-shadow:0 2px 8px rgba(0,0,0,.15); }
.chat-btn-call-ctrl:hover { background:#4b5563; }

/* Ring animation */
.chat-call-ring { animation: chatRing 1.2s ease-in-out infinite; color:#22c55e; }
@keyframes chatRing {
  0%, 100% { transform:rotate(0); }
  15% { transform:rotate(15deg); }
  30% { transform:rotate(-15deg); }
  45% { transform:rotate(10deg); }
  60% { transform:rotate(-10deg); }
  75% { transform:rotate(0); }
}

/* Call overlay */
.chat-call-overlay { position:fixed; inset:0; background:rgba(15,23,42,.92); display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:10000; }
.chat-call-status { color:#fff; font-size:16px; margin-bottom:20px; }
.chat-call-controls { display:flex; flex-direction:column; align-items:center; gap:16px; }

/* Video area */
.chat-video-area { position:relative; width:100%; flex:1; display:flex; align-items:center; justify-content:center; }
.chat-remote-video { width:100%; max-height:70vh; background:#000; border-radius:8px; }
.chat-local-video { position:absolute; bottom:20px; right:20px; width:200px; height:150px; border-radius:10px; border:2px solid #fff; background:#000; z-index:1; }

/* Image preview */
.chat-image-preview { position:relative; max-width:90vw; max-height:90vh; }
.chat-image-preview img { max-width:90vw; max-height:85vh; border-radius:8px; }
.chat-image-close { position:absolute; top:-10px; right:-10px; background:#fff !important; box-shadow:0 2px 8px rgba(0,0,0,.2); }

/* ─── Group Chat UI ─── */

/* Modal tabs */
.chat-modal-tabs { display:flex; border-bottom:1px solid #e5e7eb; padding:0 20px; gap:0; }
.chat-tab { flex:1; padding:10px 0; border:none; background:transparent; cursor:pointer; font-size:13px; font-weight:600; color:#6b7280; transition:all .2s; border-bottom:2px solid transparent; display:flex; align-items:center; justify-content:center; gap:6px; }
.chat-tab:hover { color:#3b82f6; }
.chat-tab.chat-tab-active { color:#3b82f6; border-bottom-color:#3b82f6; }

/* Group avatar in conversation list */
.chat-conv-avatar-group { width:44px; height:44px; border-radius:50%; background:linear-gradient(135deg, #3b82f6, #6366f1); display:flex; align-items:center; justify-content:center; color:#fff; font-size:18px; }

/* Group avatar in chat header */
.chat-header-avatar-group { width:40px; height:40px; border-radius:50%; background:linear-gradient(135deg, #3b82f6, #6366f1); display:flex; align-items:center; justify-content:center; color:#fff; font-size:16px; }

/* Member count in conversation row */
.chat-conv-members { font-size:12px; color:#6b7280; display:flex; align-items:center; gap:4px; }

/* Selected user chips */
.chat-group-chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; padding:4px 0; }
.chat-group-chip { display:inline-flex; align-items:center; gap:4px; padding:4px 10px; background:#eff6ff; color:#3b82f6; border-radius:16px; font-size:12px; font-weight:500; border:1px solid #bfdbfe; }
.chat-chip-remove { cursor:pointer; font-size:10px; opacity:.7; transition:opacity .15s; margin-left:2px; }
.chat-chip-remove:hover { opacity:1; }

/* User selection check mark */
.chat-user-check { margin-left:auto; color:#d1d5db; font-size:16px; transition:color .15s; flex-shrink:0; }
.chat-user-check.checked { color:#3b82f6; }
.chat-user-row.chat-user-selected { background:#eff6ff; }

/* Modal footer (create group button) */
.chat-modal-footer { padding:12px 20px; border-top:1px solid #e5e7eb; }
.chat-btn-create-group { width:100%; padding:10px; background:#3b82f6; color:#fff; border:none; border-radius:10px; font-size:14px; font-weight:600; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px; transition:background .15s; }
.chat-btn-create-group:hover { background:#2563eb; }

/* ─── Group Info Panel ─── */
.chat-group-info-panel { position:fixed; top:0; right:0; width:340px; height:100vh; background:#fff; box-shadow:-4px 0 24px rgba(0,0,0,.12); z-index:1050; display:flex; flex-direction:column; animation:slideInRight .2s ease; }
@keyframes slideInRight { from { transform:translateX(100%); } to { transform:translateX(0); } }
.chat-group-info-header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid #e5e7eb; }
.chat-group-info-header h5 { margin:0; font-size:15px; font-weight:700; color:#1f2937; display:flex; align-items:center; gap:8px; }
.chat-group-info-body { flex:1; overflow-y:auto; padding:16px 20px; }
.chat-group-info-section { margin-bottom:20px; }
.chat-group-info-label { display:block; font-size:11px; font-weight:700; color:#6b7280; text-transform:uppercase; letter-spacing:.5px; margin-bottom:8px; }
.chat-group-info-name { font-size:16px; font-weight:600; color:#1f2937; }
.chat-group-name-row { display:flex; align-items:center; gap:8px; }
.chat-group-name-edit { display:flex; align-items:center; gap:6px; margin-top:8px; }
.chat-group-name-input { flex:1; padding:8px 12px; border:1px solid #d1d5db; border-radius:8px; font-size:13px; outline:none; transition:border-color .15s; }
.chat-group-name-input:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,.1); }
.chat-btn-sm { width:30px !important; height:30px !important; min-width:30px; font-size:12px !important; }
.chat-group-member-count { font-weight:400; color:#9ca3af; }

/* Member list */
.chat-group-member-list { display:flex; flex-direction:column; gap:4px; }
.chat-group-member-row { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; transition:background .15s; }
.chat-group-member-row:hover { background:#f9fafb; }
.chat-group-member-avatar-wrap { position:relative; flex-shrink:0; }
.chat-group-member-avatar { width:36px; height:36px; border-radius:50%; object-fit:cover; }
.chat-group-member-avatar-placeholder { width:36px; height:36px; border-radius:50%; background:#e5e7eb; display:flex; align-items:center; justify-content:center; color:#9ca3af; font-size:14px; }
.chat-group-member-info { flex:1; min-width:0; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.chat-group-member-name { font-size:13px; font-weight:500; color:#1f2937; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-group-admin-badge { font-size:10px; font-weight:700; color:#3b82f6; background:#eff6ff; padding:2px 8px; border-radius:10px; }
.chat-group-you-badge { font-size:10px; font-weight:700; color:#6b7280; background:#f3f4f6; padding:2px 8px; border-radius:10px; }

/* Add member search results */
.chat-group-add-results { max-height:200px; overflow-y:auto; margin-top:8px; }
.chat-group-add-row { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:10px; cursor:pointer; transition:background .15s; }
.chat-group-add-row:hover { background:#f9fafb; }

/* Leave group button */
.chat-group-info-footer { padding:16px 20px; border-top:1px solid #e5e7eb; }
.chat-btn-leave-group { width:100%; padding:10px; background:#fef2f2; color:#ef4444; border:1px solid #fecaca; border-radius:10px; font-size:13px; font-weight:600; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px; transition:all .15s; }
.chat-btn-leave-group:hover { background:#fee2e2; border-color:#fca5a5; }

/* ─── Message Actions (hover buttons) ─── */
.chat-msg { position:relative; }
.chat-msg-actions { position:absolute; top:-8px; display:none; gap:2px; background:#fff; border:1px solid #e5e7eb; border-radius:8px; padding:2px 4px; box-shadow:0 2px 8px rgba(0,0,0,.12); z-index:5; }
.chat-msg-sent .chat-msg-actions { right:0; }
.chat-msg-received .chat-msg-actions { left:40px; }
.chat-msg:hover .chat-msg-actions { display:flex; }
.chat-msg-action-btn { background:none; border:none; cursor:pointer; color:#6b7280; padding:4px 6px; border-radius:4px; font-size:12px; line-height:1; transition:all .15s; }
.chat-msg-action-btn:hover { background:#f3f4f6; color:#1f2937; }
.chat-msg-delete-btn:hover { color:#ef4444; background:#fef2f2; }

/* ─── Reply Quote (inside message bubble) ─── */
.chat-msg-reply-quote { background:#f3f4f6; border-left:3px solid #6366f1; border-radius:6px; padding:6px 10px; margin-bottom:6px; font-size:12px; cursor:pointer; max-width:100%; overflow:hidden; }
.chat-msg-sent .chat-msg-reply-quote { background:rgba(255,255,255,.2); border-left-color:rgba(255,255,255,.6); }
.chat-reply-sender { display:block; font-weight:600; color:#6366f1; font-size:11px; margin-bottom:2px; }
.chat-msg-sent .chat-reply-sender { color:rgba(255,255,255,.85); }
.chat-reply-text { display:block; color:#6b7280; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:240px; }
.chat-msg-sent .chat-reply-text { color:rgba(255,255,255,.7); }

/* ─── Reply Bar (above input) ─── */
.chat-reply-bar { padding:8px 16px; background:#f9fafb; border-top:1px solid #e5e7eb; }
.chat-reply-bar-content { display:flex; align-items:center; gap:10px; }
.chat-reply-bar-icon { color:#6366f1; font-size:14px; flex-shrink:0; }
.chat-reply-bar-info { flex:1; min-width:0; }
.chat-reply-bar-name { display:block; font-size:12px; font-weight:600; color:#6366f1; }
.chat-reply-bar-text { display:block; font-size:12px; color:#6b7280; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ─── Emoji Picker ─── */
.chat-emoji-picker { position:absolute; bottom:100%; left:0; right:0; background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:12px; box-shadow:0 -4px 16px rgba(0,0,0,.1); display:grid; grid-template-columns:repeat(8,1fr); gap:4px; max-height:220px; overflow-y:auto; z-index:10; margin-bottom:4px; }
.chat-emoji-item { font-size:22px; padding:4px; text-align:center; cursor:pointer; border-radius:6px; transition:background .15s; line-height:1.3; }
.chat-emoji-item:hover { background:#f3f4f6; }

/* ─── Deleted Message ─── */
.chat-msg-deleted { color:#9ca3af; font-size:13px; font-style:italic; display:flex; align-items:center; gap:6px; }
.chat-msg-deleted i { font-size:11px; }

/* ─── Copy Toast ─── */
.chat-copy-toast { position:fixed; bottom:80px; left:50%; transform:translateX(-50%) translateY(20px); background:#1f2937; color:#fff; padding:8px 20px; border-radius:8px; font-size:13px; font-weight:500; opacity:0; transition:all .3s; z-index:9999; pointer-events:none; }
.chat-copy-toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ─── Reactions ─── */
.chat-msg-reactions { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; min-height:0; }
.chat-msg-reactions:empty { display:none; }
.chat-reaction-badge { display:inline-flex; align-items:center; gap:3px; padding:2px 8px; background:#f3f4f6; border:1px solid #e5e7eb; border-radius:12px; font-size:13px; cursor:pointer; transition:all .15s; line-height:1.4; }
.chat-reaction-badge:hover { background:#e5e7eb; border-color:#d1d5db; }
.chat-reaction-badge.chat-reaction-mine { background:#eef2ff; border-color:#a5b4fc; }
.chat-reaction-badge.chat-reaction-mine:hover { background:#e0e7ff; border-color:#818cf8; }
.chat-reaction-emoji { font-size:15px; line-height:1; }
.chat-reaction-count { font-size:11px; font-weight:600; color:#6b7280; }
.chat-reaction-mine .chat-reaction-count { color:#6366f1; }

/* Reaction picker (quick-react popup) */
.chat-reaction-picker { position:absolute; bottom:100%; display:flex; gap:2px; background:#fff; border:1px solid #e5e7eb; border-radius:20px; padding:4px 6px; box-shadow:0 2px 12px rgba(0,0,0,.15); z-index:15; margin-bottom:4px; }
.chat-msg-sent .chat-reaction-picker { right:0; }
.chat-msg-received .chat-reaction-picker { left:0; }
.chat-reaction-pick { font-size:20px; padding:4px 5px; cursor:pointer; border-radius:8px; transition:all .15s; line-height:1; }
.chat-reaction-pick:hover { background:#f3f4f6; transform:scale(1.2); }

/* ─── Responsive ─── */
@media (max-width:768px) {
  .chat-sidebar { width:100%; }
  .chat-main { display:none; }
  .chat-page-container.show-chat .chat-sidebar { display:none; }
  .chat-page-container.show-chat .chat-main { display:flex; }
  .chat-local-video { width:120px; height:90px; }
  .chat-modal { width:90vw; }
  .chat-group-info-panel { width:100vw; }
  .chat-emoji-picker { grid-template-columns:repeat(6,1fr); }
}
