/**
 * Shone CRM — UI 2 ("new look")
 *
 * Everything is scoped under body.ui2, so the Classic UI (which never loads this file)
 * is untouched. Built on AdminLTE 3 / Bootstrap 4 markup: pages keep their existing
 * classes and simply look different.
 *
 * Sections: tokens · base · sidebar · header · content shell · cards & KPI boxes ·
 * buttons · forms · tables (+ phone cards) · badges/alerts/misc · dashboard · login ·
 * responsive.
 */

/* ───────────────────────────── tokens ───────────────────────────── */
body.ui2 {
  --u-bg: #d3dae6;
  --u-surface: #edf0f6;
  --u-soft: #dfe5ef;
  --u-border: #b8c2d4;
  --u-border-strong: #a3aec3;
  --u-ink: #0f172a;
  --u-text: #334155;
  --u-muted: #55657b;
  --u-faint: #8391a7;

  --u-brand: #4b49ac;
  --u-brand-600: #3f3d97;
  --u-brand-2: #7978e9;
  --u-brand-soft: #eef0ff;
  --u-brand-ring: rgba(75, 73, 172, .16);

  --u-green: #16a34a;   --u-green-soft: #dcfce7;  --u-green-ink: #166534;
  --u-amber: #d97706;   --u-amber-soft: #fef3c7;  --u-amber-ink: #92400e;
  --u-red: #dc2626;     --u-red-soft: #fee2e2;    --u-red-ink: #991b1b;
  --u-cyan: #0891b2;    --u-cyan-soft: #cffafe;   --u-cyan-ink: #155e75;
  --u-violet: #7c3aed;  --u-violet-soft: #ede9fe; --u-violet-ink: #5b21b6;
  --u-slate-soft: #e2e8f0; --u-slate-ink: #334155;

  --u-radius: 14px;
  --u-radius-sm: 10px;
  --u-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --u-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px rgba(15, 23, 42, .05);
  --u-shadow-lg: 0 10px 40px rgba(15, 23, 42, .14);

  --u-side-bg: linear-gradient(180deg, #1a1942 0%, #11102b 100%);
  --u-side-w: 260px;
  --u-head-h: 64px;

  /* pages with their own <style> use these old brand variables; point them at the new palette */
  --si-blue: #4b49ac;
  --si-purple: #7978e9;
}

/* ───────────────────────────── base ───────────────────────────── */
body.ui2 {
  font-family: 'Inter', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14.5px;
  color: var(--u-text);
  background: var(--u-bg);
  -webkit-font-smoothing: antialiased;
}
body.ui2 h1, body.ui2 h2, body.ui2 h3, body.ui2 h4, body.ui2 h5, body.ui2 h6 {
  font-family: inherit; color: var(--u-ink); letter-spacing: -.01em;
}
body.ui2 a { color: var(--u-brand); }
body.ui2 a:hover { color: var(--u-brand-600); }
body.ui2 .text-muted { color: var(--u-muted) !important; }
body.ui2 .text-primary { color: var(--u-brand) !important; }
body.ui2 .text-success { color: var(--u-green) !important; }
body.ui2 .text-danger { color: var(--u-red) !important; }
body.ui2 .text-warning { color: var(--u-amber) !important; }
body.ui2 .text-info { color: var(--u-cyan) !important; }
body.ui2 ::selection { background: var(--u-brand-soft); }
body.ui2 :focus-visible { outline: 2px solid var(--u-brand-2); outline-offset: 2px; }
body.ui2 .form-control:focus-visible, body.ui2 .select2-selection:focus-visible, body.ui2 .u2-search input:focus-visible { outline: none; }

/* ───────────────────────────── sidebar ───────────────────────────── */
body.ui2 .main-sidebar {
  background: var(--u-side-bg) !important;
  box-shadow: none !important;
  border-right: 0;
}
body.ui2 .main-sidebar .brand-link {
  display: flex; align-items: center; gap: 12px;
  height: var(--u-head-h); padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07) !important;
  background: transparent !important;
}
body.ui2 .main-sidebar .brand-image {
  width: 40px; height: 40px; max-height: none; margin: 0; padding: 4px;
  background: #fff !important; border-radius: 12px; object-fit: contain;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25); opacity: 1 !important; float: none;
}
body.ui2 .main-sidebar .brand-text {
  margin: 0; font-size: 1.05rem; font-weight: 800 !important; letter-spacing: .02em;
  background: none !important; -webkit-text-fill-color: #fff !important; color: #fff !important;
}
body.ui2 .main-sidebar .brand-tagline {
  display: block; margin-top: 1px; font-size: .62rem; font-weight: 600; letter-spacing: .14em;
  color: rgba(255, 255, 255, .5); -webkit-text-fill-color: rgba(255, 255, 255, .5);
}
body.ui2 .main-sidebar .sidebar { padding: 14px 12px 24px; }
body.ui2 .u2-nav-label {
  padding: 14px 12px 6px; font-size: .66rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: rgba(255, 255, 255, .38);
}
body.ui2 .nav-sidebar .nav-item { margin-bottom: 3px; }
body.ui2 .nav-sidebar > .nav-item > .nav-link {
  display: flex; align-items: center; gap: 2px;
  min-height: 42px; padding: 9px 12px; border-radius: 11px;
  color: rgba(255, 255, 255, .72) !important; font-weight: 500; font-size: .9rem;
  transition: background .15s ease, color .15s ease;
}
body.ui2 .nav-sidebar > .nav-item > .nav-link > .nav-icon {
  flex: 0 0 22px; width: 22px; margin-right: 10px; text-align: center; font-size: 1rem;
  color: rgba(255, 255, 255, .5); transition: color .15s ease;
}
body.ui2 .nav-sidebar > .nav-item > .nav-link p { margin: 0; flex: 1; white-space: normal; }
body.ui2 .nav-sidebar .nav-link .right { color: rgba(255, 255, 255, .4); transition: transform .2s ease; }
body.ui2 .nav-sidebar > .nav-item.menu-open > .nav-link .right { transform: rotate(-90deg); }
/* long titles wrap before the arrow instead of running into it */
body.ui2 .nav-sidebar > .nav-item.has-treeview > .nav-link p { padding-right: 26px; }
body.ui2 .nav-sidebar > .nav-item > .nav-link .right { position: absolute; right: 12px; top: 50%; margin-top: -.5em; line-height: 1; }
body.ui2 .nav-sidebar > .nav-item > .nav-link:hover {
  background: rgba(255, 255, 255, .07); color: #fff !important;
}
body.ui2 .nav-sidebar > .nav-item > .nav-link:hover .nav-icon { color: #fff; }
body.ui2 .nav-sidebar > .nav-item.menu-open > .nav-link { background: rgba(255, 255, 255, .06); color: #fff !important; }
body.ui2 .nav-sidebar > .nav-item > .nav-link.active {
  background: linear-gradient(135deg, var(--u-brand) 0%, var(--u-brand-2) 100%) !important;
  color: #fff !important; box-shadow: 0 6px 18px rgba(75, 73, 172, .45);
}
body.ui2 .nav-sidebar > .nav-item > .nav-link.active .nav-icon { color: #fff; }

body.ui2 .nav-treeview { padding: 4px 0 4px 18px; margin-left: 15px; border-left: 1px solid rgba(255, 255, 255, .1); }
body.ui2 .nav-treeview > .nav-item > .nav-link {
  display: flex; align-items: center; min-height: 36px; padding: 7px 12px; border-radius: 9px;
  color: rgba(255, 255, 255, .6) !important; font-size: .85rem; font-weight: 500;
}
body.ui2 .nav-treeview > .nav-item > .nav-link .nav-icon { display: none; }
body.ui2 .nav-treeview > .nav-item > .nav-link p { margin: 0; }
body.ui2 .nav-treeview > .nav-item > .nav-link::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; margin-right: 12px; flex: 0 0 6px;
  background: rgba(255, 255, 255, .25);
}
body.ui2 .nav-treeview > .nav-item > .nav-link:hover { color: #fff !important; background: rgba(255, 255, 255, .06); }
body.ui2 .nav-treeview > .nav-item > .nav-link.active { color: #fff !important; background: rgba(121, 120, 233, .22); }
body.ui2 .nav-treeview > .nav-item > .nav-link.active::before { background: var(--u-brand-2); box-shadow: 0 0 0 3px rgba(121, 120, 233, .3); }
body.ui2 .main-sidebar .sidebar::-webkit-scrollbar { width: 6px; }
body.ui2 .main-sidebar .sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 6px; }

/* collapsed mini sidebar */
body.ui2.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-text,
body.ui2.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-tagline { display: none; }
body.ui2.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-link { padding: 0 12px; }
body.ui2.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .nav-treeview { display: none !important; }

/* ───────────────────────────── header ───────────────────────────── */
body.ui2 .main-header.u2-header {
  height: var(--u-head-h); padding: 0 22px;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--u-border); box-shadow: none;
}
body.ui2 .u2-header .nav-link { color: var(--u-text); padding: 8px 12px; border-radius: 10px; }
body.ui2 .u2-header .nav-link:hover { background: var(--u-soft); color: var(--u-ink); }
body.ui2 .u2-search { position: relative; flex: 0 1 460px; margin: 0 14px; }
body.ui2 .u2-search > i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--u-faint); pointer-events: none;
}
body.ui2 .u2-search input {
  width: 100%; height: 42px; padding: 0 48px 0 40px;
  background: var(--u-soft); border: 1px solid var(--u-border); border-radius: 12px;
  color: var(--u-ink); font-size: .9rem; transition: all .15s ease;
}
body.ui2 .u2-search input::placeholder { color: var(--u-faint); }
body.ui2 .u2-search input:focus {
  outline: none; background: var(--u-surface); border-color: var(--u-brand); box-shadow: 0 0 0 3px var(--u-brand-ring);
}
body.ui2 .u2-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: var(--u-surface); border: 1px solid var(--u-border-strong); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 7px; font-size: .72rem; color: var(--u-muted); font-family: inherit;
}
body.ui2 .u2-results {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 1100;
  background: var(--u-surface); border: 1px solid var(--u-border); border-radius: 14px; box-shadow: var(--u-shadow-lg);
  max-height: 60vh; overflow-y: auto; padding: 6px;
}
body.ui2 .u2-results.show { display: block; }
body.ui2 .u2-results a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--u-ink); text-decoration: none;
}
body.ui2 .u2-results a i { width: 18px; text-align: center; color: var(--u-brand); }
body.ui2 .u2-results a small { margin-left: auto; color: var(--u-faint); }
body.ui2 .u2-results a:hover, body.ui2 .u2-results a.sel { background: var(--u-brand-soft); }
body.ui2 .u2-results .u2-empty { padding: 14px; color: var(--u-muted); text-align: center; }
body.ui2 .u2-date {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--u-soft); border: 1px solid var(--u-border); border-radius: 10px;
  color: var(--u-muted); font-size: .82rem; font-weight: 500;
}
body.ui2 .u2-user { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px !important; border-radius: 12px; }
body.ui2 .u2-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--u-brand), var(--u-brand-2)); color: #fff; font-weight: 700; font-size: .8rem;
}
body.ui2 .u2-user .u2-who { line-height: 1.15; text-align: left; }
body.ui2 .u2-user .u2-who b { display: block; font-size: .86rem; color: var(--u-ink); font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.ui2 .u2-user .u2-who small { color: var(--u-muted); font-size: .72rem; }
body.ui2 .u2-menu { border: 1px solid var(--u-border); border-radius: 14px; box-shadow: var(--u-shadow-lg); padding: 6px; min-width: 230px; margin-top: 10px; }
body.ui2 .u2-menu .dropdown-item { border-radius: 9px; padding: 9px 12px; font-size: .88rem; color: var(--u-text); }
body.ui2 .u2-menu .dropdown-item i { width: 20px; color: var(--u-muted); }
body.ui2 .u2-menu .dropdown-item:hover { background: var(--u-brand-soft); color: var(--u-brand); }
body.ui2 .u2-menu .dropdown-item:hover i { color: var(--u-brand); }
body.ui2 .u2-menu .u2-menu-head { padding: 10px 12px 8px; }
body.ui2 .u2-menu .u2-menu-head b { display: block; color: var(--u-ink); }
body.ui2 .u2-menu .u2-menu-head small { color: var(--u-muted); }

/* ───────────────────────────── content shell ───────────────────────────── */
body.ui2 .content-wrapper { background: var(--u-bg); min-height: calc(100vh - var(--u-head-h)); }
body.ui2 .content-header { padding: 22px 24px 6px; }
body.ui2 .content-header h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
body.ui2 .content-header small, body.ui2 .content-header p.text-muted { font-size: .85rem; }
body.ui2 .breadcrumb { background: transparent; margin: 0; padding: 6px 0 0; font-size: .82rem; }
body.ui2 .breadcrumb-item + .breadcrumb-item::before { color: var(--u-faint); }
body.ui2 .breadcrumb-item.active { color: var(--u-muted); }
body.ui2 .content { padding: 8px 8px 30px; }
body.ui2 .content > .container-fluid, body.ui2 .content-header > .container-fluid { padding-left: 16px; padding-right: 16px; }
body.ui2 .main-footer {
  background: transparent; border-top: 1px solid var(--u-border); color: var(--u-muted);
  font-size: .8rem; padding: 16px 24px;
}
body.ui2 .main-footer a { color: var(--u-brand); font-weight: 600; }

/* ───────────────────────────── cards & KPI boxes ───────────────────────────── */
body.ui2 .card {
  background: var(--u-surface); border: 1px solid var(--u-border); border-radius: var(--u-radius);
  box-shadow: var(--u-shadow); margin-bottom: 20px;
}
body.ui2 .card-header {
  background: transparent; border-bottom: 1px solid var(--u-border); padding: 16px 20px;
  border-radius: var(--u-radius) var(--u-radius) 0 0;
}
body.ui2 .card-header .card-title { font-size: 1rem; font-weight: 700; color: var(--u-ink); margin: 0; float: none; }
body.ui2 .card-header::after { display: none; }
body.ui2 .card-header.bg-primary, body.ui2 .card-header.bg-success, body.ui2 .card-header.bg-info,
body.ui2 .card-header.bg-warning, body.ui2 .card-header.bg-danger, body.ui2 .card-header.bg-secondary {
  color: #fff; border-bottom: 0;
}
body.ui2 .card-header.bg-primary { background: linear-gradient(135deg, var(--u-brand), var(--u-brand-2)) !important; }
body.ui2 .card-header.bg-success { background: linear-gradient(135deg, #059669, #34d399) !important; }
body.ui2 .card-header.bg-info { background: linear-gradient(135deg, #0e7490, #22d3ee) !important; }
body.ui2 .card-header.bg-warning { background: linear-gradient(135deg, #d97706, #fbbf24) !important; }
body.ui2 .card-header.bg-danger { background: linear-gradient(135deg, #b91c1c, #f87171) !important; }
body.ui2 .card-header.bg-secondary { background: linear-gradient(135deg, #475569, #94a3b8) !important; }
body.ui2 .card-header.bg-primary .card-title, body.ui2 .card-header.bg-success .card-title,
body.ui2 .card-header.bg-info .card-title, body.ui2 .card-header.bg-warning .card-title,
body.ui2 .card-header.bg-danger .card-title, body.ui2 .card-header.bg-secondary .card-title { color: #fff; }
body.ui2 .card-body { padding: 20px; }
body.ui2 .card-body.p-0 { padding: 0 !important; }
body.ui2 .card-footer {
  background: var(--u-soft); border-top: 1px solid var(--u-border); padding: 14px 20px;
  border-radius: 0 0 var(--u-radius) var(--u-radius);
}
body.ui2 .card-outline { border-top-width: 3px; }
body.ui2 .card-primary.card-outline { border-top-color: var(--u-brand); }
body.ui2 .card-success.card-outline { border-top-color: var(--u-green); }
body.ui2 .card-info.card-outline { border-top-color: var(--u-cyan); }
body.ui2 .card-warning.card-outline { border-top-color: #f59e0b; }
body.ui2 .card-danger.card-outline { border-top-color: var(--u-red); }
body.ui2 .card-secondary.card-outline { border-top-color: #64748b; }
body.ui2 .card-tools .btn-tool { color: var(--u-muted); border-radius: 8px; }
body.ui2 .card-tools .btn-tool:hover { background: var(--u-soft); color: var(--u-ink); }

/* AdminLTE stat boxes → soft gradient KPI tiles */
body.ui2 .small-box {
  border-radius: 16px; box-shadow: var(--u-shadow); overflow: hidden; margin-bottom: 20px; border: 0;
}
body.ui2 .small-box > .inner { padding: 18px 20px 16px; }
body.ui2 .small-box > .inner h3 { font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; color: #fff; }
body.ui2 .small-box > .inner h3 small { font-size: 1rem; opacity: .8; font-weight: 600; }
body.ui2 .small-box > .inner p { font-size: .84rem; font-weight: 500; margin: 0; opacity: .95; }
body.ui2 .small-box .icon > i { color: rgba(255, 255, 255, .22); font-size: 64px; top: 14px; right: 16px; }
body.ui2 .small-box:hover .icon > i { font-size: 68px; }
body.ui2 .small-box > .small-box-footer { background: rgba(0, 0, 0, .12); padding: 7px 0; font-size: .8rem; font-weight: 600; }
body.ui2 .small-box.bg-primary { background: linear-gradient(135deg, var(--u-brand), var(--u-brand-2)) !important; }
body.ui2 .small-box.bg-success { background: linear-gradient(135deg, #059669, #34d399) !important; }
body.ui2 .small-box.bg-info { background: linear-gradient(135deg, #0e7490, #22d3ee) !important; }
body.ui2 .small-box.bg-warning { background: linear-gradient(135deg, #d97706, #fbbf24) !important; color: #fff !important; }
body.ui2 .small-box.bg-warning .inner, body.ui2 .small-box.bg-warning .inner h3,
body.ui2 .small-box.bg-warning .inner p, body.ui2 .small-box.bg-warning .small-box-footer { color: #fff !important; }
body.ui2 .small-box.bg-danger { background: linear-gradient(135deg, #b91c1c, #f87171) !important; }
body.ui2 .small-box.bg-secondary { background: linear-gradient(135deg, #475569, #94a3b8) !important; }
body.ui2 .small-box.bg-orange { background: linear-gradient(135deg, #ea580c, #fb923c) !important; }
body.ui2 .info-box {
  background: var(--u-surface); border-radius: var(--u-radius); border: 1px solid var(--u-border); box-shadow: var(--u-shadow); min-height: 76px;
}
body.ui2 .info-box .info-box-text { color: var(--u-muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
body.ui2 .info-box .info-box-number { color: var(--u-ink); font-weight: 800; font-size: 1.3rem; }

/* ───────────────────────────── buttons ───────────────────────────── */
body.ui2 .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; vertical-align: middle;
  border-radius: var(--u-radius-sm); font-weight: 600; font-size: .875rem; padding: .5rem 1rem;
  border-width: 1px; box-shadow: none; transition: all .15s ease; line-height: 1.35; text-align: center;
}
body.ui2 .btn.btn-block { display: flex; width: 100%; }
body.ui2 .btn i, body.ui2 .btn .fas, body.ui2 .btn .far, body.ui2 .btn .fab { margin: 0; flex: 0 0 auto; line-height: 1; }
body.ui2 .btn .badge { margin-left: 2px; }
body.ui2 .btn:focus { box-shadow: 0 0 0 3px var(--u-brand-ring); }
body.ui2 .btn-sm { padding: .38rem .8rem; font-size: .82rem; border-radius: 9px; }
body.ui2 .btn-xs { padding: .22rem .55rem; font-size: .74rem; border-radius: 8px; line-height: 1.4; }
body.ui2 .btn-lg { padding: .7rem 1.4rem; font-size: 1rem; border-radius: 12px; }
body.ui2 .btn-primary { background: var(--u-brand); border-color: var(--u-brand); color: #fff; }
body.ui2 .btn-primary:hover, body.ui2 .btn-primary:focus { background: var(--u-brand-600); border-color: var(--u-brand-600); }
body.ui2 .btn-success { background: var(--u-green); border-color: var(--u-green); color: #fff; }
body.ui2 .btn-success:hover { background: #15803d; border-color: #15803d; }
body.ui2 .btn-info { background: var(--u-cyan); border-color: var(--u-cyan); color: #fff; }
body.ui2 .btn-info:hover { background: #0e7490; border-color: #0e7490; color: #fff; }
body.ui2 .btn-warning { background: #f59e0b; border-color: #f59e0b; color: #fff; }
body.ui2 .btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }
body.ui2 .btn-danger { background: var(--u-red); border-color: var(--u-red); color: #fff; }
body.ui2 .btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
body.ui2 .btn-secondary { background: #64748b; border-color: #64748b; color: #fff; }
body.ui2 .btn-secondary:hover { background: #475569; border-color: #475569; }
body.ui2 .btn-light, body.ui2 .btn-default { background: var(--u-surface); border-color: var(--u-border-strong); color: var(--u-text); }
body.ui2 .btn-light:hover, body.ui2 .btn-default:hover { background: var(--u-soft); border-color: var(--u-faint); }
body.ui2 .btn-outline-primary { color: var(--u-brand); border-color: var(--u-brand); background: transparent; }
body.ui2 .btn-outline-primary:hover { background: var(--u-brand); color: #fff; }
body.ui2 .btn-outline-success { color: var(--u-green); border-color: var(--u-green); background: transparent; }
body.ui2 .btn-outline-success:hover { background: var(--u-green); color: #fff; }
body.ui2 .btn-outline-secondary { color: var(--u-muted); border-color: var(--u-border-strong); background: transparent; }
body.ui2 .btn-outline-secondary:hover { background: #64748b; border-color: #64748b; color: #fff; }
body.ui2 .btn-outline-danger { color: var(--u-red); border-color: var(--u-red); background: transparent; }
body.ui2 .btn-outline-danger:hover { background: var(--u-red); color: #fff; }
body.ui2 .btn-link { color: var(--u-brand); font-weight: 600; }
body.ui2 .btn-group > .btn { border-radius: 0; }
body.ui2 .btn-group > .btn:first-child { border-radius: var(--u-radius-sm) 0 0 var(--u-radius-sm); }
body.ui2 .btn-group > .btn:last-child { border-radius: 0 var(--u-radius-sm) var(--u-radius-sm) 0; }

/* ───────────────────────────── button rows ─────────────────────────────
   One rule for "title on the left, buttons on the right" headers, button toolbars and form button rows,
   so every page lines up the same way whatever markup it used (text-right, float-right, card-tools, col-sm-12…).
   Spacing comes from `gap`; the per-button margins (mr-1, mr-2, ml-2) pages add by hand are neutralised. */
body.ui2 .card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
body.ui2 .card-header > .card-title { flex: 1 1 auto; min-width: 0; margin: 0; line-height: 1.3; }
body.ui2 .card-header > .card-title > i, body.ui2 .card-header > .card-title > .fas { margin-right: 8px; color: var(--u-muted); }

body.ui2 .card-header .text-right:has(.btn), body.ui2 .card-header .float-right:has(.btn),
body.ui2 .card-header .card-tools:has(.btn), body.ui2 .card-header > .col-sm-12:has(.btn),
body.ui2 .content-header .text-right:has(.btn), body.ui2 .content-header .float-right:has(.btn),
body.ui2 .u2-btnrow {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
  float: none !important; flex: 0 1 auto; width: auto; max-width: none; margin: 0 !important; padding: 0 !important;
}
body.ui2 .card-header .text-right:has(.btn) > .btn, body.ui2 .card-header .float-right:has(.btn) > .btn,
body.ui2 .card-header .card-tools:has(.btn) > .btn, body.ui2 .card-header > .col-sm-12:has(.btn) > .btn,
body.ui2 .content-header .text-right:has(.btn) > .btn, body.ui2 .content-header .float-right:has(.btn) > .btn,
body.ui2 .u2-btnrow > .btn,
body.ui2 .card-header .text-right:has(.btn) > form, body.ui2 .card-header .card-tools:has(.btn) > form { margin: 0 !important; }
body.ui2 .card-header .card-tools:has(.btn-tool):not(:has(.btn:not(.btn-tool))) { margin: 0 !important; }

/* page-title row: title, then its buttons (a wrapped row stays aligned) */
body.ui2 .content-header .row { align-items: center; }
body.ui2 .content-header .row > [class*="col-"]:has(.btn) { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

/* filter / form button rows */
body.ui2 form .form-group > .btn, body.ui2 form .form-group > a.btn { margin-right: 6px; }
body.ui2 .btn + .btn:not(.btn-tool), body.ui2 .btn + form, body.ui2 form + .btn { margin-left: 6px; }
body.ui2 [class*="d-flex"][class*="justify-content-between"] { flex-wrap: wrap; gap: 10px 16px; }
body.ui2 .card-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
body.ui2 .card-footer.text-right, body.ui2 .card-footer.text-center { justify-content: flex-end; }
body.ui2 .card-footer .btn { margin: 0 !important; }
body.ui2 .card-footer .pagination { margin: 0; }
body.ui2 .btn-group { flex-wrap: nowrap; }
body.ui2 .btn-toolbar { gap: 8px; }

/* ───────────────────────────── forms ───────────────────────────── */
body.ui2 label { font-weight: 600; font-size: .8rem; color: #334155; margin-bottom: 6px; }
body.ui2 label .text-danger, body.ui2 label span.text-danger { color: var(--u-red) !important; }
body.ui2 .form-group { margin-bottom: 18px; }
body.ui2 .form-control {
  height: 42px; padding: 9px 13px; font-size: .9rem; color: var(--u-ink);
  background: var(--u-surface); border: 1px solid var(--u-border-strong); border-radius: var(--u-radius-sm);
  box-shadow: none; transition: border-color .15s ease, box-shadow .15s ease;
}
body.ui2 textarea.form-control { height: auto; min-height: 84px; }
body.ui2 .form-control::placeholder { color: var(--u-faint); }
body.ui2 .form-control:focus { border-color: var(--u-brand); box-shadow: 0 0 0 3px var(--u-brand-ring); }
body.ui2 .form-control:disabled, body.ui2 .form-control[readonly] { background: var(--u-soft); color: var(--u-muted); }
body.ui2 .form-control-sm { height: 34px; padding: 5px 10px; font-size: .82rem; border-radius: 9px; }
body.ui2 select.form-control { padding-right: 30px; }
body.ui2 select.form-control-sm { padding-right: 22px; padding-left: 8px; min-width: 64px; }
body.ui2 .table select.form-control { min-width: 70px; }
body.ui2 .input-group-text { background: var(--u-soft); border: 1px solid var(--u-border-strong); color: var(--u-muted); border-radius: var(--u-radius-sm); }
body.ui2 .input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
body.ui2 .input-group > .input-group-prepend > .input-group-text { border-top-right-radius: 0; border-bottom-right-radius: 0; }
body.ui2 .custom-control-input:checked ~ .custom-control-label::before { background-color: var(--u-brand); border-color: var(--u-brand); }
body.ui2 .custom-control-input:focus ~ .custom-control-label::before { box-shadow: 0 0 0 3px var(--u-brand-ring); }
body.ui2 .form-control.is-invalid { border-color: var(--u-red); }
body.ui2 .invalid-feedback, body.ui2 .text-danger.small { font-size: .78rem; }
body.ui2 input[type=file].form-control-file { font-size: .85rem; }
body.ui2 .form-text, body.ui2 small.text-muted { font-size: .76rem; }

/* select2 */
body.ui2 .select2-container--bootstrap4 .select2-selection,
body.ui2 .select2-container--default .select2-selection--single,
body.ui2 .select2-container--default .select2-selection--multiple {
  min-height: 42px; border: 1px solid var(--u-border-strong) !important; border-radius: var(--u-radius-sm) !important; background: var(--u-surface);
}
body.ui2 .select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
body.ui2 .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; padding-left: 13px; color: var(--u-ink); }
body.ui2 .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
body.ui2 .select2-container--default .select2-selection--single .select2-selection__arrow { top: 0; height: 40px; right: 6px; }
body.ui2 .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b,
body.ui2 .select2-container--default .select2-selection--single .select2-selection__arrow b { top: 50%; margin-top: -2px; }
body.ui2 .select2-container--bootstrap4.select2-container--focus .select2-selection,
body.ui2 .select2-container--bootstrap4.select2-container--open .select2-selection {
  border-color: var(--u-brand) !important; box-shadow: 0 0 0 3px var(--u-brand-ring) !important;
}
body.ui2 .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice,
body.ui2 .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: var(--u-brand-soft); border: 1px solid #d9dcff; color: var(--u-brand); border-radius: 8px; padding: 2px 8px; margin-top: 6px;
}
body.ui2 .select2-dropdown { border: 1px solid var(--u-border) !important; border-radius: 12px !important; box-shadow: var(--u-shadow-lg); overflow: hidden; }
body.ui2 .select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected],
body.ui2 .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--u-brand) !important; }
body.ui2 .select2-search--dropdown .select2-search__field { border-radius: 8px; border: 1px solid var(--u-border-strong); }

/* ───────────────────────────── tables ───────────────────────────── */
body.ui2 .table { color: var(--u-text); margin-bottom: 0; }
body.ui2 .table thead th {
  background: var(--u-soft); color: #475569; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border-top: 0; border-bottom: 1px solid var(--u-border); padding: 11px 12px; white-space: nowrap; vertical-align: middle;
}
body.ui2 .table td { padding: 10px 12px; vertical-align: middle; border-top: 1px solid #eef0f6; }
body.ui2 .table tbody tr:first-child td { border-top: 0; }
body.ui2 .table-sm th, body.ui2 .table-sm td { padding: 8px 12px; }
body.ui2 .table-bordered, body.ui2 .table-bordered td, body.ui2 .table-bordered th { border-color: #eef0f6; }
body.ui2 .table-bordered td, body.ui2 .table-bordered th { border-left: 0; border-right: 0; }
body.ui2 .table-bordered { border: 0; }
body.ui2 .table-hover tbody tr:hover { background: #f7f8ff; }
body.ui2 .table-striped tbody tr:nth-of-type(odd) { background: #fbfcfe; }
body.ui2 .table tfoot th, body.ui2 .table tfoot td { background: var(--u-soft); font-weight: 700; border-top: 1px solid var(--u-border); }
body.ui2 .table .btn-xs { margin: 1px; }
body.ui2 .table td:last-child .btn-xs + .btn-xs, body.ui2 .table td:last-child form { margin-left: 2px; }
body.ui2 .table td:last-child { white-space: nowrap; }
body.ui2 .table a:not(.btn):not(.badge) { font-weight: 500; }
body.ui2 .table tr.table-danger > td, body.ui2 .table tr.table-danger > th { background: #fff1f2; }
body.ui2 .table tr.table-warning > td { background: #fffbeb; }
body.ui2 .table tr.table-success > td { background: #f0fdf4; }
body.ui2 .table tr.table-secondary > td { background: #f1f5f9; }
body.ui2 .table-responsive { border-radius: 0 0 var(--u-radius) var(--u-radius); -webkit-overflow-scrolling: touch; }
body.ui2 .shone-list-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
body.ui2 .shone-list-table .col-center { text-align: center; }
/* long lists: the table scrolls inside the card so the header stays in view */
body.ui2 .u2-scroll { max-height: calc(100vh - 230px); overflow: auto; }
body.ui2 .u2-scroll thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--u-border); }
body.ui2 .pagination { gap: 4px; margin: 0; }
body.ui2 .page-link { border-radius: 9px !important; border: 1px solid var(--u-border); color: var(--u-text); margin: 0; padding: .4rem .75rem; font-size: .84rem; }
body.ui2 .page-item.active .page-link { background: var(--u-brand); border-color: var(--u-brand); color: #fff; }
body.ui2 .page-link:hover { background: var(--u-brand-soft); color: var(--u-brand); }

/* ───────────────────────────── badges, alerts, misc ───────────────────────────── */
body.ui2 .badge { border-radius: 999px; font-weight: 600; font-size: .72rem; padding: .35em .75em; letter-spacing: .01em; }
body.ui2 .badge-primary { background: var(--u-brand-soft); color: var(--u-brand); }
body.ui2 .badge-success { background: var(--u-green-soft); color: var(--u-green-ink); }
body.ui2 .badge-warning { background: var(--u-amber-soft); color: var(--u-amber-ink); }
body.ui2 .badge-danger { background: var(--u-red-soft); color: var(--u-red-ink); }
body.ui2 .badge-info { background: var(--u-cyan-soft); color: var(--u-cyan-ink); }
body.ui2 .badge-secondary { background: var(--u-slate-soft); color: var(--u-slate-ink); }
body.ui2 .badge-light { background: var(--u-soft); color: var(--u-muted); border: 1px solid var(--u-border); }
body.ui2 .badge-dark { background: #1e293b; color: #fff; }
body.ui2 .alert { border: 1px solid transparent; border-radius: 12px; padding: 12px 16px; font-size: .9rem; }
body.ui2 .alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
body.ui2 .alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
body.ui2 .alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
body.ui2 .alert-info { background: #ecfeff; border-color: #a5f3fc; color: #155e75; }
body.ui2 .alert-secondary { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
body.ui2 .alert .close { opacity: .5; }
body.ui2 .progress { height: 8px; border-radius: 999px; background: #eef0f6; box-shadow: none; }
body.ui2 .progress-xs { height: 6px; }
body.ui2 .progress-bar { border-radius: 999px; }
body.ui2 .progress-bar.bg-success { background: var(--u-green) !important; }
body.ui2 .progress-bar.bg-danger { background: var(--u-red) !important; }
body.ui2 .nav-tabs { border-bottom: 1px solid var(--u-border); }
body.ui2 .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--u-muted); font-weight: 600; padding: 10px 16px; border-radius: 0; }
body.ui2 .nav-tabs .nav-link.active { color: var(--u-brand); border-bottom-color: var(--u-brand); background: transparent; }
body.ui2 .nav-pills .nav-link.active { background: var(--u-brand); border-radius: 10px; }
body.ui2 .modal-content { border: 0; border-radius: 18px; box-shadow: var(--u-shadow-lg); }
body.ui2 .modal-header { border-bottom: 1px solid var(--u-border); padding: 16px 22px; }
body.ui2 .modal-title { font-weight: 700; }
body.ui2 .modal-footer { border-top: 1px solid var(--u-border); }
body.ui2 .dropdown-menu { border: 1px solid var(--u-border); border-radius: 12px; box-shadow: var(--u-shadow-lg); }
body.ui2 hr { border-top-color: var(--u-border); }
body.ui2 .callout { border-radius: 12px; border: 1px solid var(--u-border); border-left-width: 4px; }
body.ui2 .swal2-popup { border-radius: 18px; font-family: inherit; }

/* ───────────────────────────── dashboard ───────────────────────────── */
body.ui2 .d2-hello { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 22px; }
body.ui2 .d2-hello h2 { font-size: 1.5rem; font-weight: 800; margin: 0 0 2px; }
body.ui2 .d2-hello p { margin: 0; color: var(--u-muted); }
body.ui2 .d2-quick { display: flex; flex-wrap: wrap; gap: 8px; }
body.ui2 .d2-quick a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px;
  background: var(--u-surface); border: 1px solid var(--u-border); color: var(--u-ink); font-weight: 600; font-size: .85rem; text-decoration: none;
  box-shadow: var(--u-shadow-sm); transition: all .15s ease;
}
body.ui2 .d2-quick a i { color: var(--u-brand); }
body.ui2 .d2-quick a:hover { border-color: var(--u-brand); background: var(--u-brand-soft); transform: translateY(-1px); }
body.ui2 .d2-section { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
body.ui2 .d2-section h3 { font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--u-muted); margin: 0; }
body.ui2 .d2-section::after { content: ''; flex: 1; height: 1px; background: var(--u-border); }
body.ui2 .d2-grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
body.ui2 .d2-span-3 { grid-column: span 3; } body.ui2 .d2-span-4 { grid-column: span 4; }
body.ui2 .d2-span-6 { grid-column: span 6; } body.ui2 .d2-span-8 { grid-column: span 8; }
body.ui2 .d2-span-12 { grid-column: span 12; }
body.ui2 .d2-kpi {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: var(--u-surface);
  border: 1px solid var(--u-border); border-radius: 16px; box-shadow: var(--u-shadow); text-decoration: none !important; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; overflow: hidden;
}
body.ui2 .d2-kpi:hover { transform: translateY(-2px); box-shadow: var(--u-shadow-lg); border-color: #d9dcff; }
body.ui2 .d2-kpi .d2-ico {
  width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
}
body.ui2 .d2-kpi .d2-label { font-size: .78rem; font-weight: 600; color: var(--u-muted); }
body.ui2 .d2-kpi .d2-num { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; color: var(--u-ink); line-height: 1.1; }
body.ui2 .d2-kpi .d2-num small { font-size: .95rem; color: var(--u-faint); font-weight: 600; letter-spacing: 0; }
body.ui2 .d2-kpi .d2-sub { font-size: .78rem; color: var(--u-muted); }
body.ui2 .d2-kpi .d2-top { display: flex; align-items: center; justify-content: space-between; }
body.ui2 .d2-kpi .d2-arrow { color: var(--u-faint); transition: transform .15s ease, color .15s ease; }
body.ui2 .d2-kpi:hover .d2-arrow { transform: translateX(3px); color: var(--u-brand); }
body.ui2 .d2-tone-indigo .d2-ico { background: var(--u-brand-soft); color: var(--u-brand); }
body.ui2 .d2-tone-green .d2-ico { background: var(--u-green-soft); color: var(--u-green); }
body.ui2 .d2-tone-amber .d2-ico { background: var(--u-amber-soft); color: var(--u-amber); }
body.ui2 .d2-tone-red .d2-ico { background: var(--u-red-soft); color: var(--u-red); }
body.ui2 .d2-tone-cyan .d2-ico { background: var(--u-cyan-soft); color: var(--u-cyan); }
body.ui2 .d2-tone-violet .d2-ico { background: var(--u-violet-soft); color: var(--u-violet); }
body.ui2 .d2-panel { background: var(--u-surface); border: 1px solid var(--u-border); border-radius: 16px; box-shadow: var(--u-shadow); padding: 18px 20px; height: 100%; display: flex; flex-direction: column; }
body.ui2 .d2-panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
body.ui2 .d2-panel-head .d2-ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; }
body.ui2 .d2-panel-head h4 { font-size: .98rem; font-weight: 700; margin: 0; flex: 1; }
body.ui2 .d2-panel-head a.d2-more { font-size: .78rem; font-weight: 600; color: var(--u-brand); text-decoration: none; }
body.ui2 .d2-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
body.ui2 .d2-stat {
  display: block; padding: 11px 12px; border-radius: 12px; background: var(--u-soft); border: 1px solid #eef0f6; text-decoration: none !important;
  transition: background .15s ease, border-color .15s ease;
}
body.ui2 .d2-stat:hover { background: var(--u-brand-soft); border-color: #d9dcff; }
body.ui2 .d2-stat span { display: block; font-size: .72rem; font-weight: 600; color: var(--u-muted); margin-bottom: 3px; }
body.ui2 .d2-stat b { display: block; font-size: 1.08rem; font-weight: 800; color: var(--u-ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.ui2 .d2-stat b.neg { color: var(--u-red); } body.ui2 .d2-stat b.pos { color: var(--u-green); }
body.ui2 .d2-stat b.warn { color: var(--u-amber); } body.ui2 .d2-stat b.zero { color: var(--u-faint); }
body.ui2 .d2-empty { padding: 40px 20px; text-align: center; color: var(--u-muted); background: var(--u-surface); border: 1px dashed var(--u-border-strong); border-radius: 16px; }

/* ───────────────────────────── bill panels (Office Accounts) ─────────────────────────────
   These pages hard-code colours inline, so the classes added to their markup are styled with !important. */
body.ui2 .ob-company { border-bottom: 0 !important; margin-bottom: 8px !important; padding-bottom: 0 !important; }
body.ui2 .ob-company h5 { font-size: 1.05rem; font-weight: 800 !important; letter-spacing: .02em; color: var(--u-ink); }
body.ui2 .ob-company small { color: var(--u-muted) !important; font-weight: 500; }
body.ui2 .ob-card {
  --tone: var(--u-brand); --tone-soft: var(--u-brand-soft);
  border: 1px solid var(--u-border) !important; border-top: 3px solid var(--tone) !important; border-radius: 16px !important;
  background: var(--u-surface); box-shadow: var(--u-shadow); height: 100%; overflow: hidden;
}
body.ui2 .ob-card:has(.ob-green)  { --tone: #16a34a; --tone-soft: var(--u-green-soft); }
body.ui2 .ob-card:has(.ob-cyan)   { --tone: #0891b2; --tone-soft: var(--u-cyan-soft); }
body.ui2 .ob-card:has(.ob-slate)  { --tone: #64748b; --tone-soft: var(--u-slate-soft); }
body.ui2 .ob-card:has(.ob-violet) { --tone: #7c3aed; --tone-soft: var(--u-violet-soft); }
body.ui2 .ob-card:has(.ob-amber)  { --tone: #d97706; --tone-soft: var(--u-amber-soft); }
body.ui2 .ob-card:has(.ob-red)    { --tone: #dc2626; --tone-soft: var(--u-red-soft); }
body.ui2 .ob-head {
  display: flex; align-items: center; gap: 10px;
  background: var(--u-surface) !important; color: var(--u-ink) !important;
  padding: 16px 18px 12px !important; font-size: .98rem !important; font-weight: 700 !important;
}
body.ui2 .ob-head::before {
  content: ''; width: 30px; height: 30px; border-radius: 10px; flex: 0 0 30px;
  background: var(--tone-soft) radial-gradient(circle at center, var(--tone) 0 5px, transparent 6px);
}
body.ui2 .ob-table { border-collapse: separate !important; border-spacing: 0; }
body.ui2 .ob-table td {
  padding: 11px 18px !important; border: 0 !important; border-top: 1px solid #eef0f6 !important;
  font-size: .88rem; color: var(--u-muted);
}
body.ui2 .ob-table td + td { text-align: right; font-variant-numeric: tabular-nums; }
body.ui2 .ob-table td + td, body.ui2 .ob-table td + td a { font-size: 1rem; }
body.ui2 .ob-table tr:hover td { background: var(--u-soft); }
body.ui2 .ob-table td a { text-decoration: none; }
body.ui2 .ob-table td a:hover { text-decoration: underline; }
@media (max-width: 767.98px) { body.ui2 .ob-card { height: auto; } }

/* ───────────────────────────── login ───────────────────────────── */
body.login-page.ui2-login {
  background: radial-gradient(1100px 600px at 12% -10%, #e0e1ff 0%, transparent 60%), radial-gradient(900px 500px at 100% 110%, #ffe3e6 0%, transparent 55%), #f4f6fb;
  font-family: 'Inter', 'Source Sans Pro', sans-serif;
}
body.ui2-login .login-box { width: 420px; max-width: 92vw; }
body.ui2-login .card { border: 1px solid #fff; border-radius: 22px; box-shadow: 0 24px 60px rgba(75, 73, 172, .18); }
body.ui2-login .card-body { padding: 28px 28px 24px; }
body.ui2-login .login-box-msg { font-size: 1rem; font-weight: 700; color: var(--u-ink, #0f172a); letter-spacing: 0; }
body.ui2-login .form-control { height: 46px; border-radius: 12px; border: 1px solid #d6dbe8; }
body.ui2-login .form-control:focus { border-color: #4b49ac; box-shadow: 0 0 0 3px rgba(75, 73, 172, .16); }
body.ui2-login .input-group > .form-control:not(:last-child) { border-radius: 12px 0 0 12px; }
body.ui2-login .input-group-text { border-radius: 0 12px 12px 0; background: #f8fafc; border: 1px solid #d6dbe8; color: #4b49ac; height: 46px; padding: 0 14px; }
body.ui2-login .input-group-append .input-group-text span { color: #4b49ac; }
body.ui2-login #togglePassword { background: #f8fafc; color: #4b49ac; cursor: pointer; }
body.ui2-login .row > .col-8, body.ui2-login .row > .col-4 { flex: 0 0 100%; max-width: 100%; }
body.ui2-login .row > .col-4 { margin-top: 14px; }
body.ui2-login .btn-primary { height: 46px; border-radius: 12px; font-weight: 700; background: linear-gradient(135deg, #4b49ac, #7978e9); border: 0; box-shadow: 0 8px 22px rgba(75, 73, 172, .35); }

/* ───────────────────────────── responsive ───────────────────────────── */
@media (max-width: 1199.98px) {
  body.ui2 .d2-span-3 { grid-column: span 6; }
  body.ui2 .d2-span-4 { grid-column: span 6; }
  body.ui2 .d2-span-8 { grid-column: span 12; }
}
@media (max-width: 991.98px) {
  body.ui2 .main-header.u2-header { padding: 0 12px; }
  body.ui2 .u2-search { flex: 1 1 auto; margin: 0 8px; }
  body.ui2 .u2-search kbd { display: none; }
  body.ui2 .main-sidebar { box-shadow: 0 0 60px rgba(0, 0, 0, .35) !important; }
  body.ui2 .content-header { padding: 16px 12px 4px; }
  body.ui2 .content { padding: 6px 2px 24px; }
}
@media (max-width: 767.98px) {
  body.ui2 { font-size: 14px; }
  body.ui2 .content-header h1 { font-size: 1.3rem; }
  body.ui2 .content-header .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; text-align: left !important; }
  body.ui2 .content-header .breadcrumb { float: none !important; padding-top: 4px; }
  body.ui2 .content > .container-fluid, body.ui2 .content-header > .container-fluid { padding-left: 10px; padding-right: 10px; }
  body.ui2 .card-body { padding: 14px; }
  body.ui2 .card-header { padding: 13px 14px; }
  body.ui2 .btn { padding: .55rem 1rem; }
  body.ui2 .btn-xs { padding: .3rem .6rem; }
  body.ui2 .u2-date { display: none !important; }
  body.ui2 .u2-user .u2-who { display: none; }
  body.ui2 .d2-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.ui2 .d2-span-3 { grid-column: span 1; }
  body.ui2 .d2-span-4, body.ui2 .d2-span-6, body.ui2 .d2-span-8, body.ui2 .d2-span-12 { grid-column: span 2; }
  body.ui2 .d2-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ui2 .d2-kpi { padding: 14px; } body.ui2 .d2-kpi .d2-num { font-size: 1.5rem; }
  body.ui2 .d2-hello h2 { font-size: 1.25rem; }
  body.ui2 .d2-quick { width: 100%; } body.ui2 .d2-quick a { flex: 1 1 calc(50% - 8px); justify-content: center; }
  body.ui2 .small-box > .inner h3 { font-size: 1.45rem; }
  body.ui2 .small-box > .inner p { white-space: normal; line-height: 1.25; }
  body.ui2 .small-box .icon { display: none; }
  body.ui2 .row > [class*="col-"] > .small-box, body.ui2 .row > [class*="col-"] > .small-box > .inner { min-width: 0; }
  body.ui2 .content .row > .col-4:has(> .small-box), body.ui2 .content .row > .col-lg-4:has(> .small-box) { flex: 0 0 50%; max-width: 50%; }
  body.ui2 .row > [class*="col-md-"], body.ui2 .row > [class*="col-lg-"] { margin-bottom: 0; }

  /* button rows: full width, buttons share each line evenly (one button = full width) */
  body.ui2 .card-header > .card-title { flex: 1 1 100%; }
  body.ui2 .card-header .text-right:has(.btn), body.ui2 .card-header .float-right:has(.btn),
  body.ui2 .card-header .card-tools:has(.btn), body.ui2 .card-header > .col-sm-12:has(.btn),
  body.ui2 .content-header .text-right:has(.btn), body.ui2 .content-header .float-right:has(.btn),
  body.ui2 .content-header .row > [class*="col-"]:has(.btn), body.ui2 .u2-btnrow {
    flex: 1 1 100%; width: 100%; justify-content: stretch;
  }
  body.ui2 .card-header .text-right:has(.btn) > .btn, body.ui2 .card-header .float-right:has(.btn) > .btn,
  body.ui2 .card-header .card-tools:has(.btn) > .btn, body.ui2 .card-header > .col-sm-12:has(.btn) > .btn,
  body.ui2 .content-header .text-right:has(.btn) > .btn, body.ui2 .content-header .float-right:has(.btn) > .btn,
  body.ui2 .content-header .row > [class*="col-"]:has(.btn) > .btn, body.ui2 .u2-btnrow > .btn {
    flex: 1 1 calc(50% - 8px); min-width: 0; white-space: normal;
  }
  body.ui2 .content-header .row > [class*="col-"]:has(.btn) { justify-content: stretch; margin-top: 6px; }
  body.ui2 form .form-group > .btn, body.ui2 form .form-group > a.btn { flex: 1 1 auto; margin: 0 6px 6px 0; }
  body.ui2 .card-body form > .row > [class*="col-"]:has(> .btn), body.ui2 .card-body form .form-group:has(> .btn) {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch;
  }
  body.ui2 .card-body form [class*="col-"]:has(> .btn) > .btn, body.ui2 .card-body form .form-group:has(> .btn) > .btn { flex: 1 1 calc(50% - 8px); margin: 0; }
  body.ui2 .card-footer .btn { flex: 1 1 auto; }
  /* a folded filter panel has its own chevron, so hide AdminLTE's separate collapse button */
  body.ui2 .card.u2-fold > .card-header .card-tools { display: none !important; }
  body.ui2 .card.u2-fold > .card-header > .card-title { flex: 1 1 auto; }

  /* filter / search panels start folded (the JS adds .u2-fold) */
  body.ui2 .card.u2-fold:not(.u2-open) > .card-body, body.ui2 .card.u2-fold:not(.u2-open) > .card-footer { display: none; }
  body.ui2 .card.u2-fold > .card-header { cursor: pointer; }
  body.ui2 .card.u2-fold > .card-header::after {
    display: inline-block; content: '\f078'; font-family: 'Font Awesome 5 Free'; font-weight: 900; float: right; color: var(--u-muted); transition: transform .2s ease;
  }
  body.ui2 .card.u2-fold.u2-open > .card-header::after { transform: rotate(180deg); }

  /* tables become cards (the JS adds .u2-stack to tables of 10 columns or fewer) */
  body.ui2 table.u2-stack, body.ui2 table.u2-stack tbody, body.ui2 table.u2-stack tfoot { display: block; width: 100%; }
  body.ui2 table.u2-stack thead { display: none; }
  body.ui2 table.u2-stack tr {
    display: block; margin: 0 0 12px; padding: 4px 14px; background: var(--u-surface);
    border: 1px solid var(--u-border); border-radius: 14px; box-shadow: var(--u-shadow-sm);
  }
  body.ui2 table.u2-stack td, body.ui2 table.u2-stack tfoot th {
    display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right;
    padding: 9px 0 !important; border: 0 !important; border-bottom: 1px dashed #eceef5 !important; background: transparent !important;
  }
  body.ui2 table.u2-stack td:last-child { border-bottom: 0 !important; }
  body.ui2 table.u2-stack td::before {
    content: attr(data-label); flex: 0 0 38%; max-width: 38%; text-align: left; color: var(--u-muted);
    font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  }
  body.ui2 table.u2-stack td[data-label=""]::before { display: none; }
  body.ui2 table.u2-stack td[data-label=""] { justify-content: flex-end; }
  body.ui2 table.u2-stack td > * { max-width: 62%; overflow-wrap: anywhere; word-break: break-word; text-align: right; }
  body.ui2 table.u2-stack td > a, body.ui2 table.u2-stack td > span { display: inline-block; }
  body.ui2 table.u2-stack td, body.ui2 table.u2-stack td * { white-space: normal !important; }
  body.ui2 table.u2-stack td .btn, body.ui2 table.u2-stack td .badge, body.ui2 table.u2-stack td i { white-space: nowrap !important; }
  body.ui2 table.u2-stack td[data-label=""] > * { max-width: none; }
  body.ui2 table.u2-stack tr[class*="table-"] { border-left: 4px solid var(--u-amber); }
  body.ui2 .table-responsive:has(> table.u2-stack), body.ui2 .card-body.table-responsive:has(> table.u2-stack) { overflow: visible; }
  body.ui2 .table-responsive:not(:has(> table.u2-stack)) { overflow-x: auto; max-width: 100%; }
  body.ui2 .card:has(> .table-responsive), body.ui2 .card:has(> .card-body > .u2-stack) { background: transparent; border: 0; box-shadow: none; }
  body.ui2 .card > .table-responsive.p-0, body.ui2 .card-body.p-0.table-responsive { padding: 0 !important; }
  /* wide tables that stay tables: smooth sideways scroll */
  body.ui2 .table-responsive > table:not(.u2-stack):not(.u2-narrow) { min-width: 640px; }

  /* forms: a sticky action bar so Save is always in reach */
  body.ui2 form .card-footer:has(button[type=submit]):not(:has(.pagination)), body.ui2 .u2-actionbar {
    position: sticky; bottom: 0; z-index: 20; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--u-border); margin: 0 -14px -14px; padding: 12px 14px;
  }
  body.ui2 form .card-footer:has(button[type=submit]):not(:has(.pagination)) .btn { flex: 1; }
  body.ui2 .card-footer:has(.pagination) { display: flex; justify-content: center; overflow-x: auto; }
  /* stacked cards: the list is the page itself, so no inner scroll box (custom-theme.css caps list boxes at 70vh) — otherwise the cards spill past
     the box and the pagination ends up in the middle of the list instead of under the last card */
  body.ui2 .table-responsive:has(> table.u2-stack), body.ui2 .content .card-body.table-responsive:has(> table.u2-stack),
  body.ui2 .content .card > .table-responsive:has(> table.u2-stack), body.ui2 .u2-scroll:has(> table.u2-stack) { max-height: none !important; overflow: visible !important; }
  body.ui2 .card-footer:has(.pagination) { clear: both; position: static; background: transparent; border-top: 0; padding: 14px 0 20px; }
  body.ui2 .card-footer:has(.pagination)::after { display: none; }
  body.ui2 .card-footer .pagination { float: none !important; justify-content: center; flex-wrap: wrap; }
}
@media (min-width: 768px) {
  body.ui2 .d2-hide-desktop { display: none !important; }
}
@media print {
  body.ui2 .main-sidebar, body.ui2 .main-header, body.ui2 .main-footer, body.ui2 .d2-quick { display: none !important; }
  body.ui2 .content-wrapper { margin-left: 0 !important; background: #fff; }
  body.ui2 .card { box-shadow: none; border: 1px solid #ddd; }
}


/* ── filter action buttons: Search / Reset / Export stay on one tidy line ── */
body.ui2 .u2-actions,
body.ui2 .u2-actcol:not(:has(.u2-actions)) { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
body.ui2 .u2-actcol { flex:0 0 auto !important; width:auto !important; max-width:100% !important; align-self:flex-end; }
body.ui2 .u2-actcol > label:first-child { display:none; }            /* the empty "&nbsp;" spacer label */
body.ui2 .u2-actcol .btn, body.ui2 .u2-actions .btn { margin:0 !important; white-space:nowrap; }
body.ui2 .u2-actcol > div:not(.u2-actions) { display:flex; flex-wrap:wrap; gap:8px; }
@media (max-width:767.98px){
  body.ui2 .u2-actcol { flex:1 1 100% !important; width:100% !important; }
  body.ui2 .u2-actions, body.ui2 .u2-actcol:not(:has(.u2-actions)), body.ui2 .u2-actcol > div { display:flex; flex-wrap:wrap; gap:8px; }
  body.ui2 .u2-actcol .btn, body.ui2 .u2-actions .btn { flex:1 1 calc(50% - 8px); }
}


/* ── page header: title (+ note) on the left, action buttons on the right ── */
body.ui2 .content-header .row:has(> [class*="col-"] .btn):not(:has(.breadcrumb)) { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px 16px; }
body.ui2 .content-header .row:has(> [class*="col-"] .btn):not(:has(.breadcrumb)) > [class*="col-"]:not(:has(.btn)) { flex:1 1 280px; width:auto; max-width:none; }
body.ui2 .content-header .row:has(> [class*="col-"] .btn):not(:has(.breadcrumb)) > [class*="col-"]:has(.btn) { flex:0 1 auto; width:auto; max-width:100%; margin-left:auto; justify-content:flex-end; }
body.ui2 .content-header h1 + small { display:block; margin-top:4px; }
@media (max-width:767.98px){
  body.ui2 .content-header .row:has(> [class*="col-"] .btn):not(:has(.breadcrumb)) > [class*="col-"]:has(.btn) { flex:1 1 100%; margin-left:0; }
}
