:root {
  --lims-primary: #0d8a72;
  --lims-primary-rgb: 13, 138, 114;
  --lims-primary-dark: #096352;
  --lims-primary-soft: #e6f5f1;
  --lims-primary-border: #bce3da;
  --lims-bg-canvas: #f4f7f8;
  --lims-bg-surface: #ffffff;
  --lims-bg-subtle: #f8fafc;
  --lims-bg-dark-slate: #0f1e2e;
  --lims-border: #e2e8f0;
  --lims-border-strong: #cbd5e1;
  --lims-text-main: #0f172a;
  --lims-text-secondary: #475569;
  --lims-text-muted: #94a3b8;
  --lims-success-text: #0d8a72;
  --lims-success-bg: #e6f5f1;
  --lims-success-border: #b5e4d8;
  --lims-info-text: #2563eb;
  --lims-info-bg: #eff6ff;
  --lims-info-border: #bfdbfe;
  --lims-warning-text: #d97706;
  --lims-warning-bg: #fffbeb;
  --lims-warning-border: #fde68a;
  --lims-danger-text: #dc2626;
  --lims-danger-bg: #fef2f2;
  --lims-danger-border: #fecaca;
  --lims-purple-text: #7c3aed;
  --lims-purple-bg: #f5f3ff;
  --lims-purple-border: #ddd6fe;
  --lims-sidebar-width: 260px;
  --lims-topbar-height: 68px;
  --lims-radius-sm: 8px;
  --lims-radius-md: 10px;
  --lims-radius-lg: 14px;
  --lims-radius-xl: 18px;
  --lims-radius-pill: 999px;
  --lims-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.03);
  --lims-shadow-raised: 0 18px 50px rgba(15, 23, 42, 0.1);
  --lims-font-sans: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --lims-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bs-body-font-family: var(--lims-font-sans);
  --bs-body-color: var(--lims-text-secondary);
  --bs-body-bg: var(--lims-bg-canvas);
  --bs-link-color: var(--lims-primary);
  --bs-link-hover-color: var(--lims-primary-dark);
  --bs-border-color: var(--lims-border);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--lims-bg-canvas);
  color: var(--lims-text-secondary);
  font-family: var(--lims-font-sans);
  font-size: 0.9rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--lims-primary);
  text-decoration: none;
}

a:hover {
  color: var(--lims-primary-dark);
}

.font-mono,
.font-monospace {
  font-family: var(--lims-font-mono) !important;
}

.lims-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 14px;
  border-radius: var(--lims-radius-sm);
  background: var(--lims-bg-dark-slate);
  color: #fff;
  transform: translateY(-140%);
  transition: transform 0.16s ease;
}

.lims-skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

/* Shell */
.lims-shell {
  min-height: 100vh;
}

.lims-main {
  min-height: 100vh;
  margin-left: var(--lims-sidebar-width);
  display: flex;
  flex-direction: column;
}

.lims-content {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: calc(var(--lims-topbar-height) + 28px) 32px 28px;
}

.lims-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 32px;
  border-top: 1px solid var(--lims-border);
  background: var(--lims-bg-surface);
  color: var(--lims-text-muted);
  font-size: 11px;
}

.lims-sidebar-overlay {
  display: none;
}

/* Sidebar */
.lims-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  width: var(--lims-sidebar-width);
  background: var(--lims-bg-surface);
  border-right: 1px solid var(--lims-border);
}

.lims-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--lims-border);
}

.lims-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--lims-primary);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 8px 20px rgba(var(--lims-primary-rgb), 0.24);
}

.lims-brand-title {
  color: var(--lims-text-main);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.lims-brand-subtitle {
  margin-top: 3px;
  color: var(--lims-text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lims-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 18px;
  scrollbar-width: thin;
}

.lims-nav-section + .lims-nav-section {
  margin-top: 18px;
}

.lims-nav-label {
  padding: 0 10px;
  margin-bottom: 8px;
  color: var(--lims-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

.lims-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 11px;
  margin-bottom: 3px;
  border-radius: var(--lims-radius-md);
  color: var(--lims-text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.lims-nav-item:hover {
  background: var(--lims-bg-subtle);
  color: var(--lims-text-main);
}

.lims-nav-item.active {
  background: var(--lims-primary-soft);
  color: var(--lims-primary);
}

.lims-nav-item.active .lims-nav-icon {
  color: var(--lims-primary);
}

.lims-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  color: var(--lims-text-muted);
  font-size: 16px;
}

.lims-nav-badge {
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-pill);
  background: var(--lims-bg-subtle);
  color: var(--lims-text-secondary);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.lims-nav-badge.badge-teal-soft {
  border-color: var(--lims-primary-border);
  background: var(--lims-primary-soft);
  color: var(--lims-primary);
}

.lims-nav-badge.badge-red-soft {
  border-color: var(--lims-danger-border);
  background: var(--lims-danger-bg);
  color: var(--lims-danger-text);
}

.lims-sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--lims-border);
}

.lims-iso-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 12px;
  background: var(--lims-primary-dark);
  color: #fff;
}

.lims-iso-card::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -34px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.lims-iso-eyebrow {
  color: rgba(255, 255, 255, 0.66);
  font-family: var(--lims-font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lims-iso-title {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.lims-iso-copy {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  line-height: 1.5;
}

.lims-iso-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.64);
  font-family: var(--lims-font-mono);
  font-size: 9px;
}

.lims-iso-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: #7ff0d7;
  box-shadow: 0 0 0 3px rgba(127, 240, 215, 0.14);
}

/* Topbar */
.lims-topbar {
  position: fixed;
  inset: 0 0 auto var(--lims-sidebar-width);
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--lims-topbar-height);
  padding: 0 28px;
  border-bottom: 1px solid var(--lims-border);
  background: var(--lims-bg-surface);
}

.lims-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 180px;
}

.lims-page-heading {
  min-width: 0;
}

.lims-page-title {
  margin: 0;
  color: var(--lims-text-main);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lims-page-subtitle {
  margin: 2px 0 0;
  color: var(--lims-text-muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lims-topbar-search {
  flex: 1 1 auto;
  max-width: 520px;
  margin: 0 auto;
}

.lims-search-control {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--lims-radius-pill);
  background: var(--lims-bg-canvas);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.lims-search-control:focus-within {
  border-color: var(--lims-primary-border);
  background: var(--lims-bg-surface);
  box-shadow: 0 0 0 3px rgba(var(--lims-primary-rgb), 0.09);
}

.lims-search-control i {
  color: var(--lims-text-muted);
  font-size: 14px;
}

.lims-search-control input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--lims-text-main);
  font-family: var(--lims-font-sans);
  font-size: 12px;
}

.lims-search-control input::placeholder {
  color: var(--lims-text-muted);
}

.lims-search-kbd {
  padding: 2px 6px;
  border: 1px solid var(--lims-border);
  border-radius: 5px;
  color: var(--lims-text-muted);
  font-family: var(--lims-font-mono);
  font-size: 9px;
  line-height: 1.4;
}

.lims-topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.lims-scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--lims-primary-border);
  border-radius: var(--lims-radius-pill);
  background: var(--lims-primary-soft);
  color: var(--lims-primary-dark);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.lims-scope-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lims-primary);
  box-shadow: 0 0 0 3px rgba(var(--lims-primary-rgb), 0.12);
}

.lims-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-md);
  background: var(--lims-bg-surface);
  color: var(--lims-text-secondary);
  font-size: 17px;
}

.lims-icon-btn:hover {
  border-color: var(--lims-primary-border);
  background: var(--lims-primary-soft);
  color: var(--lims-primary);
}

.lims-sidebar-toggle,
.lims-mobile-search {
  display: none;
}

.lims-user-menu .dropdown-menu {
  min-width: 220px;
  margin-top: 8px !important;
  padding: 6px;
  border: 1px solid var(--lims-border);
  border-radius: 12px;
  box-shadow: var(--lims-shadow-raised);
}

.lims-user-menu .dropdown-item {
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--lims-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.lims-user-menu .dropdown-item:hover {
  background: var(--lims-bg-subtle);
  color: var(--lims-text-main);
}

.lims-user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 7px 3px 3px;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-pill);
  background: var(--lims-bg-surface);
  color: var(--lims-text-main);
  text-align: left;
}

.lims-user-chip:hover {
  border-color: var(--lims-primary-border);
  background: var(--lims-bg-subtle);
}

.lims-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--lims-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.lims-avatar.lims-avatar-lg {
  flex-basis: 56px;
  width: 56px;
  height: 56px;
  font-size: 17px;
}

.lims-avatar.lims-avatar-sm {
  flex-basis: 28px;
  width: 28px;
  height: 28px;
  font-size: 9px;
}

.lims-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.lims-user-meta strong {
  max-width: 150px;
  overflow: hidden;
  color: var(--lims-text-main);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lims-user-meta small {
  max-width: 150px;
  margin-top: 2px;
  overflow: hidden;
  color: var(--lims-text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cards */
.lims-card {
  padding: 20px;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-lg);
  background: var(--lims-bg-surface);
  box-shadow: var(--lims-shadow-card);
}

.lims-card-flush {
  padding: 0;
  overflow: hidden;
}

.lims-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.lims-card-title {
  margin: 0;
  color: var(--lims-text-main);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lims-card-subtitle {
  margin: 3px 0 0;
  color: var(--lims-text-muted);
  font-size: 11px;
}

.lims-section-label {
  margin: 0 0 8px;
  color: var(--lims-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lims-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.lims-kpi {
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-lg);
  background: var(--lims-bg-surface);
  box-shadow: var(--lims-shadow-card);
}

.lims-kpi-hero {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  background: var(--lims-primary);
  color: #fff;
}

.lims-kpi-hero::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -70px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}

.lims-kpi-hero .lims-kpi-label,
.lims-kpi-hero .lims-kpi-copy {
  color: rgba(255, 255, 255, 0.72);
}

.lims-kpi-hero .lims-kpi-value {
  color: #fff;
}

.lims-kpi-hero .lims-kpi-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.lims-kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lims-kpi-label {
  color: var(--lims-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lims-kpi-value {
  margin-top: 10px;
  color: var(--lims-text-main);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.lims-kpi-copy {
  margin: 8px 0 0;
  color: var(--lims-text-muted);
  font-size: 11px;
}

.lims-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--lims-primary-soft);
  color: var(--lims-primary);
  font-size: 16px;
}

.lims-kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding: 3px 8px;
  border-radius: var(--lims-radius-pill);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.lims-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.lims-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.lims-grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 16px;
}

.lims-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lims-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lims-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.lims-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lims-empty-state {
  padding: 36px 20px;
  color: var(--lims-text-muted);
  text-align: center;
}

.lims-empty-state i {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
}

/* Tables */
.lims-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-lg);
  background: var(--lims-bg-surface);
  box-shadow: var(--lims-shadow-card);
}

.lims-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  color: var(--lims-text-secondary);
  font-size: 12px;
}

.lims-table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--lims-border);
  background: var(--lims-bg-subtle);
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.lims-table td {
  padding: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.lims-table tbody tr:last-child td {
  border-bottom: 0;
}

.lims-table tbody tr:hover {
  background: #fbfdfd;
}

.lims-table .cell-title {
  color: var(--lims-text-main);
  font-weight: 700;
}

.lims-table .cell-muted {
  color: var(--lims-text-muted);
  font-size: 10px;
}

.lims-table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

.lims-table .cell-code {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.lims-table.table-wide {
  min-width: 820px;
}

.lims-table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--lims-border);
}

/* Badges */
.lims-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--lims-radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-teal {
  border-color: var(--lims-success-border);
  background: var(--lims-success-bg);
  color: var(--lims-success-text);
}

.badge-blue {
  border-color: var(--lims-info-border);
  background: var(--lims-info-bg);
  color: var(--lims-info-text);
}

.badge-amber {
  border-color: var(--lims-warning-border);
  background: var(--lims-warning-bg);
  color: var(--lims-warning-text);
}

.badge-red {
  border-color: var(--lims-danger-border);
  background: var(--lims-danger-bg);
  color: var(--lims-danger-text);
}

.badge-purple {
  border-color: var(--lims-purple-border);
  background: var(--lims-purple-bg);
  color: var(--lims-purple-text);
}

.badge-slate {
  border-color: var(--lims-border);
  background: var(--lims-bg-subtle);
  color: var(--lims-text-secondary);
}

.lims-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Buttons */
.btn {
  border-radius: var(--lims-radius-sm);
  font-family: var(--lims-font-sans);
  font-size: 12px;
  font-weight: 600;
}

.lims-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--lims-radius-sm);
  font-family: var(--lims-font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.lims-btn-primary,
.btn-primary {
  border-color: var(--lims-primary);
  background: var(--lims-primary);
  color: #fff;
}

.lims-btn-primary:hover,
.lims-btn-primary:focus,
.btn-primary:hover,
.btn-primary:focus {
  border-color: var(--lims-primary-dark);
  background: var(--lims-primary-dark);
  color: #fff;
}

.lims-btn-secondary,
.btn-outline-secondary {
  border-color: var(--lims-border);
  background: var(--lims-bg-surface);
  color: var(--lims-text-secondary);
}

.lims-btn-secondary:hover,
.btn-outline-secondary:hover {
  border-color: var(--lims-primary-border);
  background: var(--lims-primary-soft);
  color: var(--lims-primary-dark);
}

.lims-btn-amber {
  border-color: var(--lims-warning-text);
  background: var(--lims-warning-text);
  color: #fff;
}

.lims-btn-amber:hover {
  border-color: #b45309;
  background: #b45309;
  color: #fff;
}

.lims-btn-danger,
.btn-outline-danger {
  border-color: var(--lims-danger-border);
  background: var(--lims-danger-bg);
  color: var(--lims-danger-text);
}

.lims-btn-danger:hover,
.btn-outline-danger:hover {
  border-color: var(--lims-danger-text);
  background: var(--lims-danger-text);
  color: #fff;
}

.lims-btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--lims-text-secondary);
}

.lims-btn-ghost:hover {
  background: var(--lims-bg-subtle);
  color: var(--lims-text-main);
}

.lims-btn-sm {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 10px;
}

.lims-btn-icon {
  width: 32px;
  min-height: 32px;
  padding: 0;
}

.btn:focus-visible,
.lims-btn:focus-visible,
.lims-nav-item:focus-visible,
.lims-user-chip:focus-visible,
.lims-icon-btn:focus-visible {
  outline: 3px solid rgba(var(--lims-primary-rgb), 0.22);
  outline-offset: 2px;
}

/* Forms */
.form-label {
  margin-bottom: 6px;
  color: var(--lims-text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 38px;
  border-color: var(--lims-border);
  border-radius: var(--lims-radius-sm);
  background-color: var(--lims-bg-surface);
  color: var(--lims-text-main);
  font-family: var(--lims-font-sans);
  font-size: 12px;
}

.form-control::placeholder {
  color: var(--lims-text-muted);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--lims-primary-border);
  box-shadow: 0 0 0 3px rgba(var(--lims-primary-rgb), 0.1);
}

.form-control:read-only,
.form-control[readonly] {
  background: var(--lims-bg-subtle);
  color: var(--lims-text-secondary);
}

.form-text {
  color: var(--lims-text-muted);
  font-size: 10px;
}

.form-check-input {
  border-color: var(--lims-border-strong);
}

.form-check-input:checked {
  border-color: var(--lims-primary);
  background-color: var(--lims-primary);
}

.form-check-input:focus {
  border-color: var(--lims-primary-border);
  box-shadow: 0 0 0 3px rgba(var(--lims-primary-rgb), 0.1);
}

.input-group-text {
  border-color: var(--lims-border);
  background: var(--lims-bg-subtle);
  color: var(--lims-text-muted);
  font-size: 12px;
}

.text-danger {
  color: var(--lims-danger-text) !important;
}

.validation-summary-errors ul {
  margin-bottom: 0;
  padding-left: 18px;
}

/* Alerts */
.alert {
  border-radius: var(--lims-radius-md);
  font-size: 12px;
}

.alert-success {
  border-color: var(--lims-success-border);
  background: var(--lims-success-bg);
  color: var(--lims-success-text);
}

.alert-danger {
  border-color: var(--lims-danger-border);
  background: var(--lims-danger-bg);
  color: var(--lims-danger-text);
}

.alert-warning {
  border-color: var(--lims-warning-border);
  background: var(--lims-warning-bg);
  color: var(--lims-warning-text);
}

.alert-info {
  border-color: var(--lims-info-border);
  background: var(--lims-info-bg);
  color: var(--lims-info-text);
}

/* Pagination, modal, misc */
.pagination {
  gap: 4px;
}

.page-link {
  min-width: 30px;
  padding: 5px 8px;
  border: 1px solid var(--lims-border);
  border-radius: 7px !important;
  color: var(--lims-text-secondary);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.page-link:hover {
  border-color: var(--lims-primary-border);
  background: var(--lims-primary-soft);
  color: var(--lims-primary-dark);
}

.page-item.active .page-link {
  border-color: var(--lims-primary);
  background: var(--lims-primary);
  color: #fff;
}

.page-item.disabled .page-link {
  border-color: var(--lims-border);
  background: var(--lims-bg-subtle);
  color: var(--lims-text-muted);
}

.modal-content {
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-xl);
  box-shadow: var(--lims-shadow-raised);
}

.modal-header,
.modal-footer {
  border-color: var(--lims-border);
}

.dropdown-menu {
  border-color: var(--lims-border);
  border-radius: 10px;
  font-size: 12px;
}

.dropdown-item:active {
  background: var(--lims-primary-soft);
  color: var(--lims-primary-dark);
}

.lims-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--lims-border);
  border-radius: var(--lims-radius-lg);
  background: var(--lims-bg-surface);
  box-shadow: var(--lims-shadow-card);
}

.lims-filter-field {
  min-width: 140px;
  flex: 1 1 160px;
}

.lims-filter-field.lims-filter-search {
  flex: 2 1 260px;
}

.lims-filter-actions {
  display: flex;
  gap: 6px;
}

.lims-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin: 0;
}

.lims-meta-grid dt {
  color: var(--lims-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lims-meta-grid dd {
  margin: 3px 0 0;
  color: var(--lims-text-main);
  font-size: 12px;
  font-weight: 600;
}

.lims-role-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lims-role-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.lims-role-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--lims-bg-subtle);
  color: var(--lims-primary);
  font-size: 17px;
}

.lims-role-desc {
  min-height: 36px;
  margin: 12px 0;
  color: var(--lims-text-muted);
  font-size: 11px;
  line-height: 1.55;
}

.lims-role-stats {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--lims-border);
}

.lims-stat-value {
  color: var(--lims-text-main);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.lims-stat-label {
  margin-top: 3px;
  color: var(--lims-text-muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.lims-permission-pill {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid var(--lims-primary-border);
  border-radius: 6px;
  background: var(--lims-primary-soft);
  color: var(--lims-primary-dark);
  font-family: var(--lims-font-mono);
  font-size: 9px;
  font-weight: 500;
}

.lims-health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lims-primary);
  box-shadow: 0 0 0 4px rgba(var(--lims-primary-rgb), 0.12);
}

.lims-health-dot.is-unhealthy {
  background: var(--lims-danger-text);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12);
}

/* Auth */
.lims-auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 8% 10%, rgba(var(--lims-primary-rgb), 0.08), transparent 32%),
    var(--lims-bg-canvas);
}

.lims-auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  width: 100%;
  max-width: 1240px;
  min-height: 660px;
  overflow: hidden;
  border: 1px solid var(--lims-border);
  border-radius: 24px;
  background: var(--lims-bg-surface);
  box-shadow: var(--lims-shadow-raised);
}

.lims-auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 44px;
  background: linear-gradient(155deg, var(--lims-primary-dark) 0%, #0a705e 55%, var(--lims-primary) 100%);
  color: #fff;
}

.lims-auth-brand::before,
.lims-auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.lims-auth-brand::before {
  top: -100px;
  right: -90px;
  width: 320px;
  height: 320px;
}

.lims-auth-brand::after {
  bottom: -130px;
  left: -100px;
  width: 280px;
  height: 280px;
}

.lims-auth-brand > * {
  position: relative;
  z-index: 1;
}

.lims-auth-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 23px;
  backdrop-filter: blur(6px);
}

.lims-auth-brand-title {
  margin: 20px 0 6px;
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.lims-auth-brand-copy {
  max-width: 400px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.7;
}

.lims-auth-points {
  display: grid;
  gap: 12px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}

.lims-auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
}

.lims-auth-points i {
  margin-top: 2px;
  color: #8af2dc;
}

.lims-auth-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--lims-font-mono);
  font-size: 9px;
}

.lims-auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px;
  background: var(--lims-bg-surface);
}

.lims-auth-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.lims-auth-card .form-control {
  min-height: 44px;
}

.lims-auth-title {
  margin: 0;
  color: var(--lims-text-main);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.lims-auth-copy {
  margin: 6px 0 24px;
  color: var(--lims-text-muted);
  font-size: 12px;
}

.lims-auth-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  margin-top: 18px;
  border: 1px solid var(--lims-info-border);
  border-radius: 8px;
  background: var(--lims-info-bg);
  color: #1d4ed8;
  font-size: 10px;
  line-height: 1.55;
}

.lims-auth-footnote {
  margin: 18px 0 0;
  color: var(--lims-text-muted);
  font-size: 10px;
  text-align: center;
}

/* Responsive */
@media (max-width: 1360px) {
  .lims-scope-pill {
    display: none;
  }
}

@media (max-width: 1199.98px) {
  .lims-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lims-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lims-user-meta {
    display: none;
  }

  .lims-user-chip {
    padding: 3px;
  }
}

@media (max-width: 991.98px) {
  .lims-sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--lims-shadow-raised);
  }

  body.lims-sidebar-open .lims-sidebar {
    transform: translateX(0);
  }

  .lims-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1035;
    display: block;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.lims-sidebar-open .lims-sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .lims-main {
    margin-left: 0;
  }

  .lims-topbar {
    left: 0;
    gap: 12px;
    padding: 0 18px;
  }

  .lims-sidebar-toggle {
    display: inline-flex;
  }

  .lims-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .lims-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .lims-auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .lims-auth-brand {
    min-height: 300px;
    padding: 32px;
  }

  .lims-auth-points,
  .lims-auth-footer {
    display: none;
  }

  .lims-auth-panel {
    padding: 32px;
  }
}

@media (max-width: 767.98px) {
  .lims-topbar {
    padding: 0 14px;
  }

  .lims-topbar-search {
    display: none;
  }

  .lims-mobile-search {
    display: inline-flex;
  }

  .lims-page-subtitle {
    display: none;
  }

  .lims-page-title {
    font-size: 16px;
  }

  .lims-topbar-left {
    flex: 1;
    min-width: 0;
  }

  .lims-topbar-right {
    gap: 6px;
  }

  .lims-content {
    padding: calc(var(--lims-topbar-height) + 18px) 14px 20px;
  }

  .lims-footer {
    padding: 14px;
  }

  .lims-kpi-row,
  .lims-grid-2,
  .lims-grid-3,
  .lims-grid-main {
    grid-template-columns: 1fr;
  }

  .lims-meta-grid {
    grid-template-columns: 1fr;
  }

  .lims-filter-field {
    flex-basis: 100%;
  }

  .lims-filter-actions {
    width: 100%;
  }

  .lims-auth-body {
    padding: 0;
  }

  .lims-auth-shell {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .lims-auth-brand {
    min-height: 220px;
    padding: 26px 24px;
  }

  .lims-auth-brand-title {
    font-size: 26px;
  }

  .lims-auth-panel {
    padding: 28px 20px 40px;
  }

  .lims-table th,
  .lims-table td {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
