/* Palette/fonts pulled directly from the REAL Lexlegis product (app.lexlegis.ai's own compiled
   CSS, fetched 2026-09-03 — "Editorial graphite + indigo, gold accent, Fraunces display + Inter
   UI"), not the marketing site. Sidebar is white in their actual app, brand color is indigo, and
   the dark "hero" surface is a navy-indigo gradient, not black. */
:root {
  --la-brand: #3b3aa6;
  --la-brand-600: #2f2e90;
  --la-brand-700: #25257a;
  --la-brand-50: #eef0fd;
  --la-brand-100: #dfe2fb;
  --la-gold: #b08a3e;
  --la-gold-light: #d9b265;
  --la-ink: #0b0e17;
  --la-paper: #f6f6f4;
  --la-bg-tint: #efefea;
  --la-elev-2: #fafaf7;
  --la-border: rgba(15, 18, 32, .09);
  --la-text-muted: #4a4f63;
  --la-text-subtle: #7f8497;
  --la-grad-hero: linear-gradient(165deg, #2b3160 0%, #3a4178 52%, #4a5290 100%);

  --la-primary: var(--la-brand);
  --la-primary-dark: var(--la-brand-600);
  --la-sidebar-bg: #ffffff;
  --la-sidebar-text: var(--la-text-muted);
  --la-sidebar-active: var(--la-brand);
  --la-bg: var(--la-paper);
  --la-card-bg: #ffffff;
  --la-text: var(--la-ink);
  --la-muted: var(--la-text-muted);
  --la-danger: #ad1f1f;
  --la-sidebar-width: 220px;
  --la-sidebar-collapsed-width: 72px;

  --la-font-display: 'Fraunces', 'Iowan Old Style', 'Times New Roman', Georgia, serif;
  --la-font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;

  /* Bootstrap 5.3 components read their colors from these vars — overriding them here re-skins
     every .btn-primary/.text-primary/link/etc. app-wide without touching template markup. */
  --bs-primary: var(--la-brand);
  --bs-primary-rgb: 59, 58, 166;
  --bs-link-color: var(--la-brand);
  --bs-link-color-rgb: 59, 58, 166;
  --bs-link-hover-color: var(--la-brand-600);
  --bs-body-font-family: var(--la-font-body);
  --bs-body-color: var(--la-ink);
  --bs-body-bg: var(--la-paper);
  --bs-border-color: var(--la-border);
  --bs-border-radius: .5rem;
}

body {
  background: var(--la-bg);
  color: var(--la-text);
  font-family: var(--la-font-body);
}

h1, h2, h3, h4, h5, h6, .la-font-display { font-family: var(--la-font-display); }

a { color: var(--la-primary); }

.btn-primary {
  --bs-btn-bg: var(--la-brand);
  --bs-btn-border-color: var(--la-brand);
  --bs-btn-hover-bg: var(--la-brand-600);
  --bs-btn-hover-border-color: var(--la-brand-600);
  --bs-btn-active-bg: var(--la-brand-700);
  --bs-btn-active-border-color: var(--la-brand-700);
  --bs-btn-disabled-bg: var(--la-text-subtle);
  --bs-btn-disabled-border-color: var(--la-text-subtle);
}

/* --- Layout shell --- */
.la-shell { display: flex; min-height: 100vh; }

.la-sidebar {
  width: var(--la-sidebar-width);
  background: var(--la-sidebar-bg);
  color: var(--la-sidebar-text);
  border-right: 1px solid var(--la-border);
  flex-shrink: 0;
  transition: width .15s ease;
  overflow-x: hidden;
}
.la-shell.la-sidebar-collapsed .la-sidebar { width: var(--la-sidebar-collapsed-width); }
.la-shell.la-sidebar-collapsed .la-sidebar .la-nav-label,
.la-shell.la-sidebar-collapsed .la-sidebar .la-brand-text { display: none; }

.la-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem; font-weight: 600; font-size: 1.1rem;
  font-family: var(--la-font-display);
  border-bottom: 1px solid var(--la-border);
  white-space: nowrap;
}
.la-brand-logo { height: 22px; width: auto; }

.la-nav { padding: .4rem; }
.la-nav-link {
  display: flex; align-items: center; gap: .55rem;
  padding: .45rem .55rem; margin-bottom: 1px; border-radius: 9px;
  color: var(--la-text-muted); text-decoration: none;
  font-weight: 500; font-size: .83rem;
  position: relative; white-space: nowrap;
}
.la-nav-label { overflow: hidden; text-overflow: ellipsis; }
.la-nav-link:hover { background: var(--la-elev-2); color: var(--la-text); }
.la-nav-link.active {
  background: var(--la-brand-50); color: var(--la-brand);
  box-shadow: inset 0 0 0 1px rgba(59,58,166,.08);
}
.la-nav-link.active::before {
  content: ""; position: absolute; left: -.5rem; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--la-brand);
}
.la-nav-children { padding-left: 1.25rem; }
.la-nav-parent[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.la-nav-parent .bi-chevron-down { transition: transform .15s ease; margin-left: auto; }

.la-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.la-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem; background: var(--la-card-bg); border-bottom: 1px solid var(--la-border);
  position: sticky; top: 0; z-index: 10;
}

.la-content { padding: 1.25rem; flex: 1; }

.la-breadcrumb { font-size: .85rem; color: var(--la-muted); margin-bottom: 1rem; }

/* --- Cards --- */
.la-card { background: var(--la-card-bg); border: 1px solid var(--la-border); border-radius: .5rem; }

/* --- Auth pages: split panel, navy-indigo hero side + form card --- */
.la-auth-shell { display: flex; min-height: 100vh; }

.la-auth-side {
  flex: 0 0 42%;
  background:
    radial-gradient(820px 380px at 100% 0%, rgba(160,174,194,.20), transparent 62%),
    var(--la-grad-hero);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}
.la-auth-side-inner { max-width: 380px; position: relative; }
.la-auth-side-logo { height: 28px; width: auto; filter: brightness(0) invert(1); margin-bottom: 2.5rem; }
.la-auth-side-tag {
  font-size: 1.85rem; line-height: 1.3; font-weight: 500; color: #fff;
  margin-bottom: 1.5rem;
}
.la-auth-side-sub {
  font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--la-gold-light);
  font-weight: 500; margin: 0;
}

.la-auth-panel {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--la-paper); padding: 2rem 1.5rem;
}
.la-auth-card-wrap {
  width: 100%; max-width: 400px;
  background: var(--la-card-bg); border: 1px solid var(--la-border); border-radius: .75rem;
  padding: 2.25rem 2rem;
  box-shadow: 0 1px 2px rgba(15,18,32,.05), 0 12px 32px rgba(15,18,32,.07);
}
.la-auth-card-wrap h5 { font-family: var(--la-font-display); font-size: 1.6rem; font-weight: 500; }

@media (max-width: 860px) {
  .la-auth-side { display: none; }
}

/* --- Form helpers --- */
.la-required::after { content: " *"; color: var(--la-danger); }

.la-password-toggle {
  cursor: pointer; position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--la-muted); background: none; border: none;
}
.la-password-field { position: relative; }

.la-capslock-warning { font-size: .8rem; color: var(--la-danger); margin-top: .25rem; display: none; }

/* --- Dashboard hero + quick-links --- */
.la-hero {
  background:
    radial-gradient(820px 380px at 100% 0%, rgba(160,174,194,.20), transparent 62%),
    var(--la-grad-hero);
  color: #fff;
  border-radius: .75rem;
  position: relative;
  overflow: hidden;
}
.la-hero-icon { font-size: 3.5rem; opacity: .3; color: var(--la-gold-light); }
.la-hero-name { color: var(--la-gold-light); }

.la-quick-card {
  display: flex; align-items: center; gap: .9rem;
  background: var(--la-card-bg); border: 1px solid var(--la-border); border-radius: .5rem;
  padding: 1rem; text-decoration: none; color: var(--la-text); height: 100%;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.la-quick-card:hover {
  border-color: var(--la-brand); transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 58, 166, .10); color: var(--la-text);
}
.la-quick-card > i { font-size: 1.6rem; color: var(--la-brand); }

.la-badge-soon {
  background: var(--la-bg-tint); color: var(--la-muted); border: 1px dashed var(--la-border);
  font-weight: 500; padding: .5rem .75rem;
}

/* --- Permission matrix (Groups form, per-user Edit Permissions) --- */
.la-perm-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 1rem; background: var(--la-elev-2); border: 1px solid var(--la-border);
  border-radius: .5rem; margin-bottom: 1rem;
}
.la-perm-module {
  border: 1px solid var(--la-border); border-radius: .625rem; margin-bottom: .75rem; overflow: hidden;
}
.la-perm-module-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .55rem 1rem; background: var(--la-elev-2); border-bottom: 1px solid var(--la-border);
}
.la-perm-module-name {
  font-family: var(--la-font-display); font-weight: 600; font-size: .95rem; text-transform: capitalize;
}
.la-perm-grid { display: flex; flex-wrap: wrap; gap: .5rem; padding: .9rem 1rem; }

.la-perm-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .75rem .35rem .6rem;
  border: 1px solid var(--la-border); border-radius: 999px;
  font-size: .82rem; cursor: pointer; user-select: none;
  background: var(--la-card-bg); color: var(--la-text-muted);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.la-perm-chip:hover { border-color: var(--la-brand); color: var(--la-text); }
.la-perm-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.la-perm-chip .bi-check-circle-fill { display: none; }
.la-perm-chip .bi-circle { font-size: .9rem; }
.la-perm-chip:has(input:checked) {
  background: var(--la-brand-50); border-color: var(--la-brand); color: var(--la-brand-700); font-weight: 500;
}
.la-perm-chip:has(input:checked) .bi-circle { display: none; }
.la-perm-chip:has(input:checked) .bi-check-circle-fill { display: inline-block; color: var(--la-brand); }
.la-perm-chip-override {
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--la-gold); margin-left: .1rem;
}

.la-select-all-check { cursor: pointer; }

/* --- Toasts --- */
.la-toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 1080; }

@media (max-width: 768px) {
  .la-sidebar { position: fixed; height: 100vh; z-index: 1040; left: -100%; }
  .la-shell.la-sidebar-mobile-open .la-sidebar { left: 0; }
}
