/* =========================================================================
   Liability Management - design system
   Palette: deep slate/navy nav anchored by a teal "growth" accent, warm
   amber reserved for alerts/highlights only. Glossy = soft diagonal sheen
   + layered elevation, not flat material-design cards.
   ========================================================================= */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/lib/fonts/inter/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/lib/fonts/inter/inter-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/lib/fonts/inter/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/lib/fonts/inter/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/lib/fonts/inter/inter-latin-800-normal.woff2") format("woff2");
}

:root {
  /* Core palette */
  --lm-navy-950: #0a0f1e;
  --lm-navy-900: #0f1729;
  --lm-navy-800: #16213d;
  --lm-navy-700: #202f52;
  --lm-teal-500: #14b8a6;
  --lm-teal-400: #2dd4bf;
  --lm-teal-glow: rgba(45, 212, 191, 0.35);
  --lm-amber-500: #f59e0b;
  --lm-bg: #eef2f7;
  --lm-surface: #ffffff;
  --lm-border: #e2e8f0;
  --lm-text: #101828;
  --lm-text-muted: #64748b;
  --lm-radius-lg: 16px;
  --lm-radius-md: 12px;
  --lm-radius-sm: 8px;
  --lm-shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -8px rgba(16, 24, 40, 0.10);
  --lm-shadow-lifted: 0 4px 10px rgba(16, 24, 40, 0.06), 0 20px 40px -12px rgba(16, 24, 40, 0.18);
  --sidebar-w: 236px;           /* was 272px - narrower on request */
  --sidebar-w-collapsed: 68px;  /* icon rail */
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  background: var(--lm-bg);
  color: var(--lm-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.01em; color: var(--lm-text); }

a { color: var(--lm-teal-500); }
a:hover { color: var(--lm-teal-400); }

/* ---------- App shell ---------- */
#app-shell { min-height: 100vh; }

/* ---------- Sidebar: glossy navy with a diagonal sheen ---------- */
/* Fixed while the page scrolls (sticky, full window height); the brand stays on top and only
   .lm-sidebar-scroll (the menu) scrolls when it is longer than the window. */
.lm-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  transition: width .22s ease, padding .22s ease;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(45, 212, 191, 0.16), transparent 55%),
    linear-gradient(165deg, var(--lm-navy-800) 0%, var(--lm-navy-900) 55%, var(--lm-navy-950) 100%);
  color: #e6ebf5;
  padding: 1.25rem .75rem 1.25rem;
  overflow: hidden;
  box-shadow: var(--lm-shadow-lifted);
}

.lm-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;      /* scrolling the menu never scrolls the page */
  margin-right: -.45rem;             /* scrollbar sits in the padding, not over the items */
  padding-right: .45rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.lm-sidebar-scroll::-webkit-scrollbar { width: 6px; }
.lm-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.lm-sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }
.lm-brand { flex: 0 0 auto; }

.lm-sidebar::before {
  /* the "glossy" streak: a soft light sheen across the top third */
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent);
  pointer-events: none;
}

.lm-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.5rem 1.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lm-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--lm-navy-950);
  background: linear-gradient(135deg, var(--lm-teal-400), var(--lm-teal-500) 70%);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12), 0 6px 16px -4px var(--lm-teal-glow);
}

.lm-brand-text { line-height: 1.15; min-width: 0; }
.lm-brand-text .lm-brand-title { font-weight: 700; font-size: 0.82rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.lm-brand-text .lm-brand-sub { font-size: 0.68rem; color: #94a3b8; letter-spacing: 0.02em; }

.lm-nav-group { margin-bottom: 0.15rem; }

.lm-nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: var(--lm-radius-sm);
  color: #cbd5e1;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8rem;
  transition: background-color 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
}

.lm-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.lm-nav-link .bi {
  font-size: 0.95rem;
  width: 1.25rem;
  text-align: center;
  color: var(--lm-teal-400);
}

.lm-nav-link .lm-chevron {
  margin-left: auto;
  transition: transform 0.2s ease;
  font-size: 0.75rem;
  color: #64748b;
}

.lm-nav-link[aria-expanded="true"] {
  background: linear-gradient(90deg, rgba(45, 212, 191, 0.14), transparent);
  color: #fff;
}
.lm-nav-link[aria-expanded="true"] .lm-chevron { transform: rotate(90deg); color: var(--lm-teal-400); }

.lm-submenu {
  margin: 0.1rem 0 0.3rem 0.95rem;
  padding-left: 0.7rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.lm-submenu a {
  display: block;
  padding: 0.36rem 0.6rem;
  border-radius: var(--lm-radius-sm);
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.76rem;
  transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.lm-submenu a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--lm-teal-400);
  padding-left: 0.85rem;
}

/* ---------- Topbar: frosted glass ---------- */
.lm-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--lm-border);
}

.lm-topbar .lm-user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  border-radius: 999px;
  background: var(--lm-surface);
  border: 1px solid var(--lm-border);
  box-shadow: var(--lm-shadow-soft);
}

.lm-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  background: linear-gradient(135deg, var(--lm-teal-400), var(--lm-navy-700));
}

/* ---------- Content surfaces ---------- */
.lm-content { padding: 1.75rem; }

.card {
  border: 1px solid var(--lm-border);
  border-radius: var(--lm-radius-lg) !important;
  box-shadow: var(--lm-shadow-soft);
}

.card-title { font-weight: 700; }

.table { font-size: 0.875rem; }
.table thead.table-light th {
  background: #f8fafc;
  color: var(--lm-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--lm-border);
}
.table tbody tr:hover { background: #f8fafc; }

.btn {
  border-radius: var(--lm-radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Primary action = navy with a teal glow; secondary = white "ghost" that turns teal on hover.
   Used on every page (no page-specific button classes). */
.btn-primary {
  background: var(--lm-navy-900);
  border: none;
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--lm-navy-700) !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px var(--lm-teal-glow);
}

.btn-outline-secondary, .btn-outline-primary {
  background: var(--lm-surface);
  border-color: var(--lm-border);
  color: var(--lm-text);
}
.btn-outline-secondary:hover, .btn-outline-primary:hover,
.btn-outline-secondary:focus, .btn-outline-primary:focus {
  background: var(--lm-surface);
  border-color: var(--lm-teal-500);
  color: var(--lm-teal-500);
}

.badge.text-bg-success { background: #ecfdf5 !important; color: #047857 !important; }
.badge.text-bg-secondary { background: #f1f5f9 !important; color: #64748b !important; }

.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--lm-text-muted);
  font-weight: 600;
  font-size: 0.875rem;
}
.nav-tabs .nav-link.active {
  color: var(--lm-navy-900);
  border-bottom-color: var(--lm-teal-500);
  background: transparent;
}

.form-label { font-weight: 600; font-size: 0.8rem; color: var(--lm-text-muted); }
.form-control, .form-select {
  border-radius: var(--lm-radius-sm);
  border-color: var(--lm-border);
}
.form-control:focus, .form-select:focus {
  border-color: var(--lm-teal-500);
  box-shadow: 0 0 0 3px var(--lm-teal-glow);
}

/* ---------- Login screen ---------- */
.lm-auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(60% 60% at 15% 10%, rgba(45, 212, 191, 0.18), transparent 60%),
    radial-gradient(50% 50% at 90% 90%, rgba(45, 212, 191, 0.12), transparent 60%),
    linear-gradient(165deg, var(--lm-navy-800), var(--lm-navy-950));
  padding: 1.5rem;
}

.lm-auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--lm-surface);
  border-radius: var(--lm-radius-lg);
  box-shadow: var(--lm-shadow-lifted);
  padding: 2.25rem 2rem;
}

/* ---------- Scrollbar (glossy touch) ---------- */

/* ---------- Mobile ---------- */
@media (max-width: 991.98px) {
  .lm-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .lm-sidebar.show { transform: translateX(0); }
  .lm-content { padding: 1.25rem; }
}

/* Validation summary on forms (asp-validation-summary="All"): hidden until it has errors. */
.lm-val-summary.validation-summary-valid { display: none; }
.lm-val-summary ul { margin: 0; padding-left: 1.1rem; }

/* Sidebar as nested <ul>/<li> (SidebarMenu view component). */
ul.lm-nav { list-style: none; margin: 0; padding: 0; }
ul.lm-submenu { list-style: none; }
ul.lm-submenu > li { margin: 0; }
.lm-nav-link.active { background: linear-gradient(90deg, rgba(45, 212, 191, 0.14), transparent); color: #fff; }
.lm-submenu a.active { color: var(--lm-teal-400); background: rgba(255, 255, 255, 0.05); font-weight: 600; }
.lm-nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Smooth sub menu: eased height + items fading/sliding in one after another. */
.lm-submenu.collapsing { transition: height .3s cubic-bezier(.4, 0, .2, 1); }
.lm-submenu.show > li, .lm-submenu.collapsing > li { animation: lm-sub-in .28s cubic-bezier(.4, 0, .2, 1) both; }
.lm-submenu > li:nth-child(2) { animation-delay: .02s; }
.lm-submenu > li:nth-child(3) { animation-delay: .04s; }
.lm-submenu > li:nth-child(4) { animation-delay: .06s; }
.lm-submenu > li:nth-child(5) { animation-delay: .08s; }
.lm-submenu > li:nth-child(n+6) { animation-delay: .1s; }
@keyframes lm-sub-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.lm-nav-link .lm-chevron { transition: transform .25s cubic-bezier(.4, 0, .2, 1), color .2s; }
.lm-flyout-title { display: none; }
@media (prefers-reduced-motion: reduce) {
  .lm-submenu.collapsing { transition: none; }
  .lm-submenu > li { animation: none !important; }
  .lm-sidebar { transition: none; }
}

/* ---------- Collapsed sidebar (desktop): icon rail, sub menus pop out on hover ---------- */
.lm-collapse-btn { align-items: center; }
@media (min-width: 992px) {
  .lm-sb-collapsed .lm-sidebar { width: var(--sidebar-w-collapsed); padding-left: .6rem; padding-right: .6rem; z-index: 30; }
  .lm-sb-collapsed .lm-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .lm-sb-collapsed .lm-brand-text,
  .lm-sb-collapsed .lm-nav-text,
  .lm-sb-collapsed .lm-chevron { display: none; }
  .lm-sb-collapsed .lm-nav-link { justify-content: center; padding: .6rem 0; }
  .lm-sb-collapsed .lm-nav-link .bi { font-size: 1.1rem; width: auto; }
  .lm-sb-collapsed .lm-nav-group { position: relative; }
  .lm-sb-collapsed .lm-nav-group.has-active > .lm-nav-link { background: rgba(45, 212, 191, .14); }

  /* Pop-out: full height whatever the expand/collapse state, shown on hover/focus. position:fixed so the
     scrolling menu can't clip it - the layout script sets its top beside the hovered icon. */
  .lm-sb-collapsed .lm-submenu {
    display: none !important; height: auto !important; position: fixed; left: calc(var(--sidebar-w-collapsed) + .45rem); top: 0; min-width: 210px;
    margin: 0; padding: .4rem; border-left: none; z-index: 60; border-radius: var(--lm-radius-md);
    background: linear-gradient(165deg, var(--lm-navy-800), var(--lm-navy-950)); box-shadow: var(--lm-shadow-lifted);
  }
  /* Hover bridge over the gap between the icon and the pop-out, so moving across doesn't close it. */
  .lm-sb-collapsed .lm-submenu::before { content: ""; position: absolute; left: -1.4rem; top: 0; bottom: 0; width: 1.4rem; }
  .lm-sb-collapsed .lm-nav-group:hover > .lm-submenu,
  .lm-sb-collapsed .lm-nav-group:focus-within > .lm-submenu { display: flex !important; animation: lm-flyout-in .16s ease both; }
  .lm-sb-collapsed .lm-flyout-title { display: block; padding: .35rem .6rem .45rem; margin-bottom: .2rem; font-size: .7rem; font-weight: 700;
                                       letter-spacing: .05em; text-transform: uppercase; color: var(--lm-teal-400); border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .lm-sb-collapsed .lm-submenu > li { animation: none; }
}
@keyframes lm-flyout-in { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   Shared page components - every page uses these (no per-page copies).
   ========================================================================= */

/* ---------- Page header: icon + title + one-line description, actions on the right ---------- */
.lm-page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.lm-page-head h4 { margin: 0; font-weight: 700; }
.lm-page-sub { font-size: .875rem; color: var(--lm-text-muted); }
.lm-page-icon { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem;
                color: var(--lm-teal-400); background: linear-gradient(135deg, var(--lm-navy-900), var(--lm-navy-700)); box-shadow: var(--lm-shadow-soft); }
.lm-page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Segmented switch (scheme switch, list filters): links or buttons, one .active */
.lm-segment { display: inline-flex; border: 1px solid var(--lm-border); border-radius: 999px; overflow: hidden; background: var(--lm-surface); }
.lm-segment > a, .lm-segment > button { border: none; background: transparent; padding: .35rem .9rem; font-size: .82rem; color: var(--lm-text-muted); text-decoration: none; }
.lm-segment > .active { background: var(--lm-navy-900); color: #fff; }

/* ---------- Panel: white card with optional head / foot strips ---------- */
.lm-panel { background: var(--lm-surface); border: 1px solid var(--lm-border); border-radius: var(--lm-radius-lg); box-shadow: var(--lm-shadow-soft);
            display: flex; flex-direction: column; overflow: hidden; }
.lm-panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .85rem 1.25rem; border-bottom: 1px solid var(--lm-border); }
.lm-panel-title { font-weight: 700; color: var(--lm-navy-900); display: flex; align-items: center; gap: .5rem; }
.lm-panel-title .bi { color: var(--lm-teal-500); }
.lm-panel-body { padding: 1.25rem; flex: 1; }
.lm-panel-foot { display: flex; gap: .5rem; flex-wrap: wrap; padding: .9rem 1.25rem; border-top: 1px solid var(--lm-border); background: #f8fafc; }
.lm-narrow { max-width: 720px; }

/* Numbered section of a long form */
.lm-step { background: var(--lm-surface); border: 1px solid var(--lm-border); border-radius: var(--lm-radius-lg); box-shadow: var(--lm-shadow-soft);
           padding: 1.1rem 1.25rem 1.25rem; margin-bottom: 1rem; }
.lm-step-head { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--lm-navy-900); margin-bottom: .9rem; }
.lm-step-no { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem;
              background: rgba(20, 184, 166, .12); color: var(--lm-teal-500); }

/* Small uppercase label above a group of fields */
.lm-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--lm-text-muted); margin-bottom: .5rem; }
.lm-label .bi { color: var(--lm-teal-500); margin-right: .25rem; }

/* Dashed inner box (payment sub-fields, term inputs, ...) */
.lm-subpanel { border: 1px dashed var(--lm-border); border-radius: var(--lm-radius-md); padding: .8rem; background: #fbfcfe; }

/* ---------- Text helpers ---------- */
.lm-sub { font-size: .78rem; color: var(--lm-text-muted); }
.lm-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.lm-id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 700; color: var(--lm-navy-900); }
.lm-min0 { min-width: 0; }
.lm-words { font-size: .82rem; color: var(--lm-text-muted); font-style: italic; min-height: 1.2em; }
.lm-count { font-size: 1.35rem; font-weight: 800; color: var(--lm-navy-900); margin-right: .25rem; }
.lm-total-pill { font-size: .8rem; font-weight: 700; color: var(--lm-navy-900); background: #e0f2f1; padding: .15rem .6rem; border-radius: 999px; }

/* ---------- Pills / badges ---------- */
.lm-pill { font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: #eef2ff; color: #3730a3; white-space: nowrap; }
.lm-pill-amber { color: #92400e; background: #fef3c7; }
.lm-badge { display: inline-block; font-size: .66rem; font-weight: 700; padding: .05rem .45rem; border-radius: 4px; background: #eef2ff; color: #3730a3; }
.lm-badge-cyan { background: #ecfeff; color: #155e75; }
.lm-badge-amber { background: #fef3c7; color: #92400e; }
.lm-badge-green { background: #f0fdf4; color: #166534; }
.lm-badge-red { background: #fee2e2; color: #991b1b; }

/* ---------- Avatars / person card ---------- */
.lm-avatar-soft { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700;
                  color: var(--lm-navy-900); background: linear-gradient(135deg, #ccfbf1, #e0e7ff); }
.lm-person { display: flex; align-items: center; gap: .75rem; height: 100%; min-height: 62px; padding: .6rem .85rem;
             border: 1px solid var(--lm-border); border-radius: var(--lm-radius-md); background: #fbfcfe; }
.lm-person-sm { min-height: 58px; }
.lm-person.is-found { border-color: rgba(20, 184, 166, .45); background: rgba(20, 184, 166, .05); }

/* ---------- Pill radio group (payment mode etc.) ---------- */
.lm-modes { display: flex; flex-wrap: wrap; gap: .35rem; }
.lm-mode { margin: 0; cursor: pointer; }
.lm-mode input { position: absolute; opacity: 0; pointer-events: none; }
.lm-mode span { display: inline-block; padding: .35rem .7rem; font-size: .8rem; border: 1px solid var(--lm-border); border-radius: 999px; background: var(--lm-surface); }
.lm-mode input:checked + span { background: var(--lm-navy-900); color: #fff; border-color: var(--lm-navy-900); }
.lm-mode input:focus-visible + span { outline: 2px solid var(--lm-teal-400); outline-offset: 2px; }

/* ---------- Data table: rows become cards on narrow screens (no sideways scroll) ---------- */
.lm-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .86rem; }
.lm-table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--lm-text-muted); font-weight: 700;
               padding: .6rem .9rem; background: #f8fafc; border-bottom: 1px solid var(--lm-border); text-align: left; }
.lm-table td { padding: .7rem .9rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; overflow-wrap: anywhere; }
.lm-table tbody tr { transition: background .12s; }
.lm-table tbody tr:hover { background: #f8fbff; box-shadow: inset 3px 0 0 var(--lm-teal-400); }
.lm-table tbody tr:last-child td { border-bottom: none; }
.lm-table .lm-row-editing { background: #fffbeb; box-shadow: inset 3px 0 0 var(--lm-amber-500); }
.lm-actions { display: inline-flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.lm-icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--lm-border); background: var(--lm-surface); color: var(--lm-navy-700);
               display: inline-grid; place-items: center; padding: 0; text-decoration: none; }
.lm-icon-btn:hover { background: var(--lm-navy-900); color: var(--lm-teal-400); border-color: var(--lm-navy-900); }
.lm-icon-btn.lm-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }

.lm-empty { text-align: center; padding: 2.5rem 1rem; color: var(--lm-text-muted); }
.lm-empty .bi { font-size: 2rem; color: var(--lm-teal-500); display: block; margin-bottom: .5rem; }

@media (max-width: 991.98px) {
  .lm-table thead { display: none; }
  .lm-table, .lm-table tbody, .lm-table tr, .lm-table td { display: block; width: 100%; }
  .lm-table tr { padding: .75rem 1rem; border-bottom: 1px solid var(--lm-border); }
  .lm-table td { border: none; padding: .15rem 0; }
  /* Each cell shows its column name above the value - except the row's main cell (.lm-cell-main). */
  .lm-table td[data-label]:not([data-label=""]):not(.lm-cell-main)::before {
    content: attr(data-label); display: block; font-size: .66rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--lm-text-muted); margin-top: .35rem; }
  .lm-table td.text-end { text-align: left !important; margin-top: .4rem; }
  .lm-actions { justify-content: flex-start; }
}

/* ---------- Dense data grid: one line per row, smaller type (search results with many rows) ----------
   <div class="lm-table-wrap"><table class="lm-table lm-table-sm">; long text cells get .lm-ellipsis. */
.lm-table-wrap { overflow-x: auto; }
.lm-table.lm-table-sm { table-layout: auto; font-size: .78rem; }
.lm-table-sm th { padding: .45rem .45rem; font-size: .63rem; white-space: nowrap; }
.lm-table-sm td { padding: .3rem .45rem; white-space: nowrap; }
.lm-table-sm .lm-icon-btn { width: 26px; height: 26px; font-size: .8rem; border-radius: 6px; }
.lm-table-sm .lm-badge { font-size: .62rem; }
.lm-table-sm tbody tr:nth-child(even) { background: #fbfcfe; }
.lm-ellipsis { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
@media (max-width: 991.98px) {
  .lm-table-wrap { overflow-x: visible; }
  .lm-table-sm td { white-space: normal; }
  .lm-ellipsis { max-width: none; }
}

/* ---------- Compact filter bar (small controls, secondary filters behind "More filters") ---------- */
.lm-filters { padding: .75rem 1rem; }
.lm-filters .form-label { font-size: .7rem; margin-bottom: .2rem; }
.lm-filters .form-control, .lm-filters .form-select { font-size: .82rem; padding-top: .3rem; padding-bottom: .3rem; }
.lm-filters .btn { padding-top: .3rem; padding-bottom: .3rem; white-space: nowrap; }
.lm-filter-toggle { border: none; background: none; padding: 0; font-size: .8rem; font-weight: 600; color: var(--lm-navy-700); white-space: nowrap; }
.lm-filter-toggle .bi { transition: transform .2s; display: inline-block; }
.lm-filter-toggle:not(.collapsed) .bi { transform: rotate(180deg); }

/* ---------- Detail view: label / value pairs ---------- */
.lm-dl { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: .45rem .75rem; margin: 0; font-size: .875rem; }
.lm-dl dt { font-weight: 600; color: var(--lm-text-muted); }
.lm-dl dd { margin: 0; overflow-wrap: anywhere; }
.lm-thumb { max-height: 110px; border-radius: 6px; border: 1px solid var(--lm-border); }
.lm-thumb-sm { max-height: 70px; }

/* ---------- Dark summary panel (live totals beside a form) ---------- */
.lm-summary { border-radius: var(--lm-radius-lg); padding: 1.25rem; color: #e6ebf5; box-shadow: var(--lm-shadow-lifted);
              background: radial-gradient(120% 80% at 100% 0%, rgba(45, 212, 191, .18), transparent 60%), linear-gradient(165deg, var(--lm-navy-800), var(--lm-navy-950)); }
.lm-sticky { position: sticky; top: 4.5rem; }
.lm-summary-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #9aa7c0; margin-bottom: .75rem; }
.lm-summary-empty { text-align: center; color: #9aa7c0; padding: 1.5rem 0; }
.lm-summary-empty .bi { font-size: 1.8rem; color: var(--lm-teal-400); display: block; margin-bottom: .4rem; }
.lm-big { font-size: 1.9rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.1; }
.lm-row { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid rgba(255, 255, 255, .08); font-size: .86rem; }
.lm-row span:first-child { color: #9aa7c0; }
.lm-row b { color: #fff; font-variant-numeric: tabular-nums; text-align: right; }
.lm-accent { color: var(--lm-teal-400) !important; }
.lm-error { color: #fca5a5; font-size: .88rem; }

/* ---------- Dashboard stat card ---------- */
.lm-stat-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(45, 212, 191, .12); color: var(--lm-teal-500); }
.lm-stat-icon.lm-amber { background: rgba(245, 158, 11, .12); color: var(--lm-amber-500); }

/* ---------- Stepper: a long form split into steps, one visible at a time ----------
   Markup: .lm-stepper > button.lm-stepper-item[data-step] (number + name + hint), then one
   [data-step-panel] per step; .is-active / .is-done / .has-error set by script. */
.lm-stepper { position: sticky; top: 3.6rem; z-index: 10; display: grid; grid-template-columns: repeat(var(--lm-steps, 4), 1fr); gap: .5rem;
              padding: .5rem; margin-bottom: 1rem; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px);
              border: 1px solid var(--lm-border); border-radius: var(--lm-radius-lg); box-shadow: var(--lm-shadow-soft); }
.lm-stepper-item { display: flex; align-items: center; gap: .6rem; min-width: 0; padding: .45rem .6rem; text-align: left;
                   border: 1px solid transparent; border-radius: var(--lm-radius-md); background: transparent; color: var(--lm-text-muted); }
.lm-stepper-item:hover { background: #f8fafc; }
.lm-stepper-no { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem;
                 background: #f1f5f9; color: var(--lm-text-muted); transition: all .15s; }
.lm-stepper-name { display: block; font-weight: 700; font-size: .85rem; color: var(--lm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-stepper-hint { display: block; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lm-stepper-item.is-active { background: rgba(20, 184, 166, .07); border-color: rgba(20, 184, 166, .35); }
.lm-stepper-item.is-active .lm-stepper-no { background: var(--lm-navy-900); color: var(--lm-teal-400); }
.lm-stepper-item.is-done .lm-stepper-no { background: rgba(20, 184, 166, .15); color: var(--lm-teal-500); }
.lm-stepper-item.has-error .lm-stepper-no { background: #fee2e2; color: #b91c1c; }
.lm-stepper-item.has-error .lm-stepper-hint { color: #b91c1c; }
[data-step-panel] { display: none; }
[data-step-panel].is-active { display: block; animation: lm-fade .18s ease; }
@keyframes lm-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.lm-wizard-bar { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
                 padding: .75rem 1rem; margin: 0 0 1rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
                 border: 1px solid var(--lm-border); border-radius: var(--lm-radius-lg); box-shadow: var(--lm-shadow-soft); }
.input-validation-error, .input-validation-error:focus { border-color: #dc3545 !important; }
.input-validation-error:focus { box-shadow: 0 0 0 3px rgba(220, 53, 69, .2) !important; }
/* A fixed-width part of an input group (Age, S/O, branch code) - the other part takes the rest. */
.input-group > .lm-flex-none { flex: 0 0 auto; }
.input-group > .form-control[readonly] { background: #f8fafc; }
.lm-step-sub { border-top: 1px dashed var(--lm-border); margin-top: 1.1rem; padding-top: 1rem; }
@media (max-width: 767.98px) {
  .lm-stepper { grid-template-columns: repeat(var(--lm-steps, 4), auto); justify-content: space-between; top: 3.4rem; }
  .lm-stepper-item { padding: .35rem; }
  .lm-stepper-item > span:last-child { display: none; }   /* phones: numbers only */
  .lm-stepper-item.is-active > span:last-child { display: block; }
}

/* ---------- Alerts (shared _Alerts partial, rendered by the layouts) ---------- */
.lm-alert { display: flex; align-items: flex-start; gap: .5rem; border-radius: var(--lm-radius-md); padding: .65rem .9rem; margin-bottom: 1rem; }
.lm-alert .bi { margin-top: .15rem; }

/* Instant list search in a panel head (js/table-filter.js) */
.lm-table-search-wrap { position: relative; width: 260px; max-width: 100%; }
.lm-table-search-wrap .bi { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .8rem; pointer-events: none; }
.lm-table-search-wrap .lm-table-search { padding-left: 1.85rem; font-size: .82rem; }
@media (max-width: 575.98px) { .lm-table-search-wrap { width: 100%; } }

/* Close (x) on every message box (js/alert-close.js) */
.alert.lm-has-x { position: relative; padding-right: 2.4rem; }
.lm-alert-x { position: absolute; top: .35rem; right: .4rem; width: 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: inherit; opacity: .6; font-size: .8rem; line-height: 1; padding: 0; cursor: pointer; }
.lm-alert-x:hover, .lm-alert-x:focus-visible { opacity: 1; background: rgba(0,0,0,.07); outline: none; }
.alert.lm-alert-closed { display: none !important; }

/* Report grids: printed/completed rows, totals footer, click-to-sort headers (js/table-filter.js) */
.lm-table tbody tr.lm-row-done, .lm-table-sm tbody tr.lm-row-done:nth-child(even) { background: #f0fdf4; }
.lm-table tfoot .lm-total-row td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--lm-border); white-space: nowrap; }
.lm-table th[data-sort] { cursor: pointer; user-select: none; }
.lm-table th[data-sort]:hover { color: var(--lm-navy-900); }
.lm-table th[data-sort]::after { content: "\2195"; opacity: .3; margin-left: .25rem; font-size: .9em; }
.lm-table th[data-sort][aria-sort="ascending"]::after { content: "\2191"; opacity: .8; }
.lm-table th[data-sort][aria-sort="descending"]::after { content: "\2193"; opacity: .8; }
@media (max-width: 991.98px) {
  .lm-table tfoot, .lm-table tfoot tr, .lm-table tfoot td { display: block; width: 100%; }
  .lm-table tfoot td:empty { display: none; }
  .lm-table tfoot td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; }
}

/* Attachment tiles (Member Details) */
.lm-attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.lm-attach { display: block; text-align: center; text-decoration: none; color: inherit; border: 1px solid var(--lm-border);
             border-radius: 10px; padding: .5rem; background: var(--lm-surface); transition: border-color .15s, box-shadow .15s; }
a.lm-attach:hover { border-color: var(--lm-teal-500); box-shadow: 0 2px 10px rgba(15, 23, 41, .08); }
.lm-attach-thumb { height: 92px; display: grid; place-items: center; border-radius: 6px; background: #f8fafc; overflow: hidden; margin-bottom: .4rem; }
.lm-attach-thumb img { max-width: 100%; max-height: 92px; object-fit: contain; }
.lm-attach-thumb .bi { font-size: 2rem; color: var(--lm-teal-500); }
.lm-attach.is-missing { border-style: dashed; color: var(--lm-text-muted); }
.lm-attach.is-missing .lm-attach-thumb .bi { color: #cbd5e1; }
.lm-attach-label { font-weight: 600; font-size: .8rem; }
.lm-attach-sub { font-size: .7rem; color: var(--lm-text-muted); }

/* Account detail popup (Reports/FDDetail) */
.lm-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
                  background: var(--lm-surface); border: 1px solid var(--lm-border); border-radius: var(--lm-radius-lg, 14px); padding: .85rem 1rem; margin-bottom: .75rem; }
.lm-detail-photo { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; border: 1px solid var(--lm-border); flex: none; }
.lm-detail-photo-empty { display: grid; place-items: center; background: #f1f5f9; color: #94a3b8; font-size: 1.6rem; }
.lm-detail-kicker { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--lm-teal-500); }
.lm-detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.lm-detail-stats > div { background: var(--lm-navy-900, #0f1729); color: #fff; border-radius: 10px; padding: .55rem .8rem; }
.lm-detail-stats span { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.lm-detail-stats strong { font-size: 1.02rem; }
/* Colourful variant: <div class="lm-detail-stats lm-detail-stats-tones"> - each tile its own colour (8, then repeats);
   an icon may lead the label: <span><i class="bi bi-person"></i> Member Id</span>. */
.lm-detail-stats-tones > div { box-shadow: 0 2px 6px rgba(15, 23, 42, .12); }
.lm-detail-stats-tones > div:nth-child(8n+1) { background: linear-gradient(135deg, #2563eb, #1e40af); }
.lm-detail-stats-tones > div:nth-child(8n+2) { background: linear-gradient(135deg, #0d9488, #0f766e); }
.lm-detail-stats-tones > div:nth-child(8n+3) { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.lm-detail-stats-tones > div:nth-child(8n+4) { background: linear-gradient(135deg, #db2777, #9d174d); }
.lm-detail-stats-tones > div:nth-child(8n+5) { background: linear-gradient(135deg, #d97706, #b45309); }
.lm-detail-stats-tones > div:nth-child(8n+6) { background: linear-gradient(135deg, #0891b2, #155e75); }
.lm-detail-stats-tones > div:nth-child(8n+7) { background: linear-gradient(135deg, #4f46e5, #3730a3); }
.lm-detail-stats-tones > div:nth-child(8n+8) { background: linear-gradient(135deg, #16a34a, #166534); }
.lm-detail-stats-tones span { opacity: .85; }
.lm-detail-stats-tones span .bi { margin-right: .2rem; }
.lm-detail .lm-dl { margin-bottom: 0; }
.btn.lm-btn-xs { padding: .12rem .45rem; font-size: .68rem; line-height: 1.3; border-radius: 6px; white-space: nowrap; }
