/* ==========================================================================
   UltraGuard Pro — Components & UI Elements
   Single source of truth for all reusable components.
   Visual tokens come from :root in admin-theme.css.
   ========================================================================== */

/* ==========================================================================
   MODALS
   ========================================================================== */
.ultraguard-modals-container {
  display: none !important;
}

.ultraguard-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: var(--ug-z-modal-backdrop, 99999);
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ultraguard-modal-overlay.active,
.ultraguard-modal-overlay[style*="display: flex"] {
  display: flex !important;
  opacity: 1;
}

.ultraguard-modal-overlay.ultraguard-modal-hidden {
  display: none !important;
}

.ultraguard-modal {
  background: var(--ug-bg-primary);
  border-radius: var(--ug-radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  /* Modal open/close animation — will-change is appropriate here */
  will-change: opacity, transform;
  transform: scale(0.97);
  transition: transform 0.2s ease;
}

.ultraguard-modal-overlay[style*="display: flex"] .ultraguard-modal {
  transform: scale(1);
}

.ultraguard-modal-small  { max-width: 500px; }
.ultraguard-modal-medium { max-width: 800px; }
.ultraguard-modal-large  { max-width: 1000px; }
.ultraguard-modal-xlarge { max-width: 1200px; }

.ultraguard-modal-header {
  padding: var(--ug-spacing-lg) var(--ug-spacing-xl);
  border-bottom: 1px solid var(--ug-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.ultraguard-modal-title {
  margin: 0;
  font-size: var(--ug-font-size-xl);
  font-weight: 700;
  color: var(--ug-dark);
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-sm);
}

.ultraguard-modal-title .dashicons {
  color: var(--ug-primary);
}

.dashicons.ultraguard-fa-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  vertical-align: middle;
}

.dashicons.ultraguard-fa-icon i {
  font-size: 1em;
  line-height: 1;
  color: currentColor;
}

.ultraguard-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--ug-gray);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ug-radius-round);
  transition: background var(--ug-transition-fast), color var(--ug-transition-fast), transform var(--ug-transition-fast);
  flex-shrink: 0;
}

.ultraguard-modal-close:hover {
  background: var(--ug-bg-tertiary);
  color: var(--ug-error);
  transform: rotate(90deg);
  outline: none;
}

.ultraguard-modal-body {
  padding: var(--ug-spacing-xl);
  overflow-y: auto;
  flex: 1;
  max-height: calc(90vh - 160px);
  scrollbar-width: thin;
  scrollbar-color: var(--ug-gray-lighter) var(--ug-bg-secondary);
}

.ultraguard-modal-body::-webkit-scrollbar { width: 6px; }
.ultraguard-modal-body::-webkit-scrollbar-track { background: var(--ug-bg-secondary); }
.ultraguard-modal-body::-webkit-scrollbar-thumb {
  background: var(--ug-gray-lighter);
  border-radius: 3px;
}

.ultraguard-modal-footer {
  padding: var(--ug-spacing-lg) var(--ug-spacing-xl);
  border-top: 1px solid var(--ug-border);
  display: flex;
  gap: var(--ug-spacing-sm);
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--ug-bg-secondary);
}

.ultraguard-modal-footer:empty { display: none; }

.ultraguard-modal-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--ug-gray);
}

.ultraguard-spinner {
  border: 3px solid var(--ug-bg-tertiary);
  border-top-color: var(--ug-primary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: ultraguard-spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes ultraguard-spin {
  to { transform: rotate(360deg); }
}

body.ultraguard-modal-open { overflow: hidden; }

/* ==========================================================================
   LIVE SCAN CARDS
   Keep server-rendered running state visually identical to JS-started state.
   ========================================================================== */
.ug-scan-live-stats .ultraguard-list,
.fc-live-stats-row .ultraguard-list,
.ug-db-scan-stats .ultraguard-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 6px 0 2px;
  border: 0;
  background: transparent;
}

.ug-scan-live-stats .ultraguard-list-item,
.fc-live-stats-row .ultraguard-list-item,
.ug-db-scan-stats .ultraguard-list-item {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
  padding: 0;
  border: 0;
}

.ug-scan-live-stats .ultraguard-list-item:hover,
.fc-live-stats-row .ultraguard-list-item:hover,
.ug-db-scan-stats .ultraguard-list-item:hover {
  background: transparent;
  margin: 0;
  border-radius: 0;
}

.ug-scan-live-stats .ultraguard-list-badge,
.fc-live-stats-row .ultraguard-list-badge,
.ug-db-scan-stats .ultraguard-list-badge {
  margin-left: auto;
  min-width: 32px;
  text-align: center;
}

#ug-scan-panel #ug-progress-fill > .ultraguard-component,
#fc-scan-progress-card #fc-scan-progress-bar > .ultraguard-component,
#ug-db-scan-panel #db-scan-progress-bar > .ultraguard-component {
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.ultraguard-button,
.button.ultraguard-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--ug-radius-md);
  background: var(--ug-bg-primary);
  color: var(--ug-text, var(--ug-dark));
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--ug-font-family);
  line-height: 1;
  cursor: pointer;
  /* Only transition visual properties — no transform on base state */
  transition: background var(--ug-transition-fast),
              border-color var(--ug-transition-fast),
              box-shadow var(--ug-transition-fast),
              color var(--ug-transition-fast);
  white-space: nowrap;
  user-select: none;
  min-height: 36px;
  margin: 0 !important;
}

.ultraguard-button:hover {
  box-shadow: var(--ug-shadow-sm);
  /* NO transform here — avoids stacking context churn on lists of buttons */
}

.ultraguard-button:active {
  box-shadow: none;
}

.ultraguard-button:focus {
  outline: none;
  box-shadow: var(--ug-shadow-focus);
}

.ultraguard-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none !important;
}

.ultraguard-button .dashicons {
  font-size: 15px;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Variants */
.ultraguard-button-primary,
.button.ultraguard-button-primary {
  background: var(--ug-primary);
  border-color: var(--ug-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(14,165,233,.25);
}

.ultraguard-button-primary:hover {
  background: var(--ug-primary-dark);
  border-color: var(--ug-primary-dark);
  color: #fff;
  box-shadow: 0 3px 8px rgba(14,165,233,.30);
  transform: translateY(-1px);
}

.ultraguard-button-secondary,
.button.ultraguard-button-secondary {
  background: var(--ug-bg-primary);
  border-color: var(--ug-border);
  color: var(--ug-text, var(--ug-dark));
  box-shadow: var(--ug-shadow-xs);
}

.ultraguard-button-secondary:hover {
  background: var(--ug-bg-hover, var(--ug-bg-secondary));
  border-color: var(--ug-gray-lighter);
  box-shadow: var(--ug-shadow-sm);
}

.ultraguard-button-success,
.button.ultraguard-button-success {
  background: var(--ug-gradient-success);
  border-color: var(--ug-success);
  color: #fff;
}

.ultraguard-button-success:hover {
  background: var(--ug-success-dark);
  border-color: var(--ug-success-dark);
  color: #fff;
  transform: translateY(-1px);
}

.ultraguard-button-error,
.ultraguard-button-danger,
.button.ultraguard-button-error,
.button.ultraguard-button-danger {
  background: var(--ug-error);
  border-color: var(--ug-error);
  color: #fff;
}

.ultraguard-button-error:hover,
.ultraguard-button-danger:hover {
  background: var(--ug-error-dark);
  border-color: var(--ug-error-dark);
  color: #fff;
  transform: translateY(-1px);
}

.ultraguard-button-warning,
.button.ultraguard-button-warning {
  background: var(--ug-gradient-warning);
  border-color: var(--ug-warning);
  color: #fff;
}

.ultraguard-button-warning:hover {
  background: var(--ug-warning-dark);
  border-color: var(--ug-warning-dark);
  color: #fff;
  transform: translateY(-1px);
}

.ultraguard-button-info,
.button.ultraguard-button-info {
  background: var(--ug-gradient-info, linear-gradient(135deg,#0277bd,#58a5f0));
  border-color: var(--ug-info, #0277bd);
  color: #fff;
}

/* Button sizes */
.ultraguard-button-small { padding: 5px 11px !important; font-size: 12px !important; min-height: 30px !important; }
.ultraguard-button-large { padding: 11px 22px !important; font-size: 14px !important; min-height: 42px !important; }
.ultraguard-button-mini  { padding: 4px 8px !important;   font-size: 11px !important; min-height: 24px !important; }

.ultraguard-button-icon-only {
  width: 36px !important;
  min-width: 36px !important;
  padding: 8px !important;
}

/* ==========================================================================
   BUTTON GROUPS
   ========================================================================== */
.ultraguard-button-group {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: var(--ug-spacing-xs);
  flex-wrap: wrap;
  margin: 0 !important;
  padding: 0 !important;
}

.ultraguard-button-group > .ultraguard-button,
.ultraguard-button-group > .button,
.ultraguard-button-group > button,
.ultraguard-button-group > a {
  margin: 0 !important;
  float: none !important;
  flex: 0 0 auto;
}

.ultraguard-button-group-left    { justify-content: flex-start; }
.ultraguard-button-group-center  { justify-content: center; }
.ultraguard-button-group-right   { justify-content: flex-end; }
.ultraguard-button-group-vertical {
  flex-direction: column !important;
  align-items: stretch !important;
}

.wp-admin .ultraguard-button-group {
  display: flex !important;
  flex-direction: row !important;
}
.wp-admin .ultraguard-button-group .button {
  margin: 0 !important;
  float: none !important;
}

/* ==========================================================================
   FORM FIELDS
   ========================================================================== */
.ultraguard-field-wrapper {
  margin-bottom: var(--ug-spacing-sm);
}

.ultraguard-field-label {
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-xs);
  margin-bottom: var(--ug-spacing-sm);
  font-weight: 600;
  color: var(--ug-dark);
  font-size: var(--ug-font-size-md);
}

.ultraguard-field {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-md);
  background: var(--ug-bg-primary);
  color: var(--ug-text, var(--ug-dark));
  font-size: 13px;
  font-family: var(--ug-font-family);
  line-height: var(--ug-line-height-normal);
  transition: border-color var(--ug-transition-fast), box-shadow var(--ug-transition-fast);
  outline: none;
  min-height: 38px;
}

.ultraguard-field:hover {
  border-color: var(--ug-gray-lighter);
}

.ultraguard-field:focus {
  border-color: var(--ug-primary);
  box-shadow: var(--ug-shadow-focus);
}

.ultraguard-field:disabled {
  background: var(--ug-bg-tertiary);
  color: var(--ug-gray);
  cursor: not-allowed;
  opacity: 0.7;
}

.ultraguard-field::placeholder { color: var(--ug-gray-lighter); }

.ultraguard-field-description {
  font-size: var(--ug-font-size-sm);
  color: var(--ug-gray);
  margin-top: 4px;
  line-height: var(--ug-line-height-normal);
}

.ultraguard-form-textarea .ultraguard-field {
  min-height: 100px;
  resize: vertical;
}

.ultraguard-form-select .ultraguard-field {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 36px;
  appearance: none;
}

/* Two-column form layout */
.ultraguard-form-container {
  background: var(--ug-bg-primary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-lg);
  padding: var(--ug-spacing-xl);
  box-shadow: var(--ug-shadow-sm);
  margin-bottom: var(--ug-spacing-lg);
}

.ultraguard-form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--ug-spacing-lg);
  align-items: start;
}

.ultraguard-form-row       { display: contents; }
.ultraguard-form-row-full  { grid-column: 1 / -1; display: grid; grid-template-columns: 200px 1fr; gap: var(--ug-spacing-lg); align-items: start; }
.ultraguard-form-full-width { grid-column: 1 / -1; }

.ultraguard-form-label {
  display: flex;
  align-items: flex-start;
  gap: var(--ug-spacing-xs);
  padding: var(--ug-spacing-sm) 0;
  font-weight: 600;
  color: var(--ug-dark);
  font-size: var(--ug-font-size-md);
  text-align: right;
  justify-content: flex-end;
}

.ultraguard-form-label-required::after {
  content: '*';
  color: var(--ug-error);
  margin-left: 4px;
}

.ultraguard-form-input { padding: var(--ug-spacing-sm) 0; }

.ultraguard-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: var(--ug-spacing-sm);
  align-items: center;
  justify-content: flex-end;
  padding-top: var(--ug-spacing-lg);
  margin-top: var(--ug-spacing-lg);
  border-top: 1px solid var(--ug-border);
}

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */
.ultraguard-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--ug-spacing-md);
  cursor: pointer;
  user-select: none;
}

.ultraguard-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.ultraguard-toggle-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  background: var(--ug-gray-lighter);
  border-radius: 12px;
  transition: background var(--ug-transition-fast);
  flex-shrink: 0;
}

.ultraguard-toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--ug-transition-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.ultraguard-toggle-input:checked + .ultraguard-toggle-slider {
  background: var(--ug-success);
}

.ultraguard-toggle-input:checked + .ultraguard-toggle-slider::before {
  transform: translateX(20px);
}

.ultraguard-toggle-input:focus + .ultraguard-toggle-slider {
  box-shadow: var(--ug-shadow-focus);
}

.ultraguard-toggle-label {
  font-size: var(--ug-font-size-md);
  font-weight: 500;
  color: var(--ug-dark);
}

/* ==========================================================================
   CARDS
   ========================================================================== */
.ultraguard-card {
  background: var(--ug-bg-primary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-lg);
  box-shadow: var(--ug-shadow-xs);
  overflow: hidden;
  /* Margin inside grids is overridden by the grid gap — keep 0 default */
  margin-bottom: 18px;
  /* NO transform on hover — cards inside grids would create hundreds of
     stacking contexts and cause forced repaints on scroll                  */
  transition: box-shadow var(--ug-transition-fast);
}

.ultraguard-card:last-child {
  margin-bottom: 0;
}

.ultraguard-card:hover {
  box-shadow: var(--ug-shadow-sm);
  /* box-shadow only — compositor-friendly, no layout invalidation */
}

.ultraguard-card-header {
  padding: var(--ug-spacing-md);
  border-bottom: 1px solid var(--ug-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--ug-spacing-md);
  flex-wrap: wrap;
}

.ultraguard-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ug-dark);
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-sm);
  flex: 1 1 220px;
  min-width: 0;
}

.ultraguard-card-title .dashicons {
  color: var(--ug-primary);
  font-size: 18px;
  width: 18px;
  height: 18px;
}

.ultraguard-card-actions {
  display: flex;
  gap: var(--ug-spacing-sm);
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

.ultraguard-card-body {
  padding: var(--ug-spacing-md);
}

.ultraguard-card-body > *:last-child {
  margin-bottom: 0;
}

.ultraguard-card-footer {
  padding: var(--ug-spacing-sm) var(--ug-spacing-md);
  border-top: 1px solid var(--ug-border);
  background: var(--ug-bg-secondary);
}

/* Danger card variant */
.ug-danger-card {
  border-color: rgba(239,68,68,.25);
}

/* ==========================================================================
   BADGES
   ========================================================================== */
.ultraguard-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--ug-radius-round);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.ultraguard-badge-info      { background: rgba(2,119,189,.10);  color: var(--ug-info, #0277bd); }
.ultraguard-badge-success   { background: rgba(16,185,129,.12); color: var(--ug-success-dark); }
.ultraguard-badge-warning   { background: rgba(245,158,11,.12); color: var(--ug-warning-dark); }
.ultraguard-badge-error,
.ultraguard-badge-danger    { background: rgba(239,68,68,.10);  color: var(--ug-error-dark); }
.ultraguard-badge-primary   { background: rgba(14,165,233,.10); color: var(--ug-primary-dark); }
.ultraguard-badge-secondary { background: rgba(100,116,139,.12);color: var(--ug-text-secondary, #475569); }

.ultraguard-header-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: middle;
  margin-left: 10px;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}

/* ==========================================================================
   STAT CARDS
   ========================================================================== */
.ultraguard-stat-card {
  position: relative;
  padding: var(--ug-spacing-md);
  background: var(--ug-bg-primary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-md);
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-md);
  box-shadow: var(--ug-shadow-xs);
  overflow: hidden;
  /* No hover transform — inside grids causes mass recompositing */
  transition: box-shadow var(--ug-transition-fast);
}

.ultraguard-stat-card:hover {
  box-shadow: var(--ug-shadow-sm);
}

.ultraguard-stat-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ug-gradient-primary);
  color: #fff;
  border-radius: var(--ug-radius-md);
  font-size: 20px;
  flex-shrink: 0;
}

.ultraguard-stat-content {
  flex: 1;
  min-width: 0;
}

.ultraguard-stat-title {
  font-size: var(--ug-font-size-sm);
  font-weight: 600;
  color: var(--ug-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.ultraguard-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ug-dark);
  line-height: 1;
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-sm);
}

.ultraguard-stat-card-success { border-left: 3px solid var(--ug-success); }
.ultraguard-stat-card-warning { border-left: 3px solid var(--ug-warning); }
.ultraguard-stat-card-error   { border-left: 3px solid var(--ug-error);   }
.ultraguard-stat-card-info    { border-left: 3px solid var(--ug-info, #0277bd); }

/* ==========================================================================
   TABS
   ========================================================================== */
.ultraguard-tabs {
  background: var(--ug-bg-primary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-lg);
  overflow: hidden;
  box-shadow: var(--ug-shadow-sm);
  margin-bottom: var(--ug-spacing-lg);
}

/* Tab nav — pill style (theme defines the bg/radius) */
.ultraguard-tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--ug-bg-tertiary);
  border-radius: var(--ug-radius-lg);
  border: none;
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}

.ultraguard-tab-nav::-webkit-scrollbar { display: none; }

.ultraguard-tab-nav-item {
  margin: 0;
  flex: 0 0 auto;
}

.ultraguard-tab-nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--ug-radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--ug-text-secondary, var(--ug-gray));
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--ug-font-family);
  /* Only transition color/bg — no layout properties */
  transition: background var(--ug-transition-fast), color var(--ug-transition-fast),
              box-shadow var(--ug-transition-fast);
  min-height: 38px;
}

.ultraguard-tab-nav-link:hover {
  color: var(--ug-text, var(--ug-dark));
  background: rgba(255,255,255,.5);
}

.ultraguard-tab-nav-item.ultraguard-tab-active .ultraguard-tab-nav-link,
.ultraguard-tab-nav-link.active {
  background: var(--ug-bg-primary);
  color: var(--ug-dark);
  font-weight: 600;
  box-shadow: var(--ug-shadow-xs);
}

.ultraguard-tab-nav-link .dashicons {
  font-size: 15px;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ultraguard-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--ug-primary);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* Tab content */
.ultraguard-tab-content {
  padding: var(--ug-spacing-md);
}

.ultraguard-tab-pane {
  display: none;
}

.ultraguard-tab-pane.ultraguard-tab-active {
  display: block;
  animation: ug-fade-in 180ms ease;
}

@keyframes ug-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Vertical tabs */
.ultraguard-tabs-vertical {
  display: flex;
  min-height: 400px;
}

.ultraguard-tabs-vertical .ultraguard-tab-nav {
  flex-direction: column;
  border-radius: 0;
  border-right: 1px solid var(--ug-border);
  border-bottom: none;
  min-width: 180px;
  margin-bottom: 0;
  padding: var(--ug-spacing-sm);
  background: var(--ug-bg-secondary);
}

.ultraguard-tabs-vertical .ultraguard-tab-nav-link {
  min-height: 38px;
}

.ultraguard-tabs-vertical .ultraguard-tab-nav-item.ultraguard-tab-active .ultraguard-tab-nav-link {
  background: var(--ug-bg-primary);
  box-shadow: none;
  border-left: 2px solid var(--ug-primary);
  border-radius: 0 var(--ug-radius-sm) var(--ug-radius-sm) 0;
}

.ultraguard-tabs-vertical .ultraguard-tab-content {
  flex: 1;
  padding: var(--ug-spacing-lg);
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */
.ultraguard-table-wrapper {
  background: var(--ug-bg-primary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-lg);
  overflow: visible;           /* allow table-container scroll on mobile */
  box-shadow: var(--ug-shadow-sm);
  margin-bottom: var(--ug-spacing-lg);
}

.ultraguard-data-table-wrapper {
  border-radius: var(--ug-radius-lg);
  overflow: hidden;
  border: 1px solid var(--ug-border);
}

.ultraguard-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ultraguard-data-table th {
  background: var(--ug-bg-tertiary);
  color: var(--ug-text-secondary, var(--ug-gray));
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ug-border);
  white-space: nowrap;
  vertical-align: middle;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ultraguard-data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--ug-border);
  color: var(--ug-text, var(--ug-dark));
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.ultraguard-data-table tr:last-child td { border-bottom: none; }

.ultraguard-data-table tbody tr {
  transition: background var(--ug-transition-fast);
}

.ultraguard-data-table tbody tr:hover td {
  background: var(--ug-bg-hover, var(--ug-bg-secondary));
}

.ultraguard-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ug-spacing-sm) var(--ug-spacing-md);
  background: var(--ug-bg-secondary);
  border-top: 1px solid var(--ug-border);
  gap: var(--ug-spacing-md);
  flex-wrap: wrap;
  min-height: 44px;
}

.ultraguard-table-footer:empty { display: none; }

.ultraguard-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ug-spacing-md);
  padding: var(--ug-spacing-sm) var(--ug-spacing-md);
  background: var(--ug-bg-secondary);
  border-bottom: 1px solid var(--ug-border);
  flex-wrap: wrap;
  min-height: 48px;
}

.ultraguard-table-toolbar:empty { display: none; }

.ultraguard-table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  /* Clip table to rounded corners via clip-path (unlike overflow:hidden, 
     this doesn't prevent scrolling in child elements) */
  border-radius: var(--ug-radius-lg);
}

.ultraguard-table-empty {
  text-align: center;
  color: var(--ug-gray);
  font-style: italic;
  padding: var(--ug-spacing-xl) !important;
}

/* Search */
.ultraguard-table-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 360px;
  margin-left: auto;
}

.ultraguard-search-form {
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-xs);
  width: 100%;
}

.ultraguard-search-input {
  flex: 1;
  height: 34px;
  padding: 0 var(--ug-spacing-md);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-md);
  background: var(--ug-bg-primary);
  color: var(--ug-dark);
  font-size: 13px;
  font-family: var(--ug-font-family);
  transition: border-color var(--ug-transition-fast), box-shadow var(--ug-transition-fast);
  outline: none;
}

.ultraguard-search-input:focus {
  border-color: var(--ug-primary);
  box-shadow: var(--ug-shadow-focus);
}

.ultraguard-sortable {
  cursor: pointer;
  user-select: none;
}

.ultraguard-sortable:hover { background: var(--ug-bg-hover, var(--ug-bg-secondary)); }
.ultraguard-sortable::after { content: '↕'; margin-left: 4px; opacity: 0.4; font-size: 10px; }
.ultraguard-sortable.ultraguard-sort-asc::after  { content: '↑'; opacity: 1; }
.ultraguard-sortable.ultraguard-sort-desc::after { content: '↓'; opacity: 1; }

/* Cell actions */
.ultraguard-data-table th.ultraguard-column-actions,
.ultraguard-data-table td.ultraguard-cell-actions {
  width: 1%;
  white-space: nowrap;
}

.ultraguard-data-table td.ultraguard-cell-actions {
  text-align: right;
  vertical-align: middle;
}

.ultraguard-data-table td.ultraguard-cell-actions > .ultraguard-row-actions,
.ultraguard-data-table td.ultraguard-cell-actions > .ultraguard-button-group,
.ultraguard-data-table td.ultraguard-cell-actions > .ultraguard-cell-inner,
.ultraguard-cell-actions:not(td) {
  display: inline-flex;
  gap: var(--ug-spacing-xs);
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: 100%;
}

.ultraguard-data-table td.ultraguard-cell-actions > .ultraguard-cell-inner {
  width: 100%;
}

.ultraguard-data-table td.ultraguard-cell-actions .ultraguard-button,
.ultraguard-cell-actions:not(td) .ultraguard-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.ultraguard-data-table td.ultraguard-cell-actions .ultraguard-button-group,
.ultraguard-data-table td.ultraguard-cell-actions .ultraguard-row-actions,
.ultraguard-cell-actions:not(td) .ultraguard-button-group,
.ultraguard-row-actions {
  flex-wrap: nowrap !important;
  gap: 6px !important;
  justify-content: flex-end;
}

.ultraguard-data-table td.ultraguard-cell-actions .ultraguard-button-icon-only,
.ultraguard-cell-actions:not(td) .ultraguard-button-icon-only,
.ultraguard-row-actions .ultraguard-button-icon-only {
  width: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 6px !important;
  border-radius: 12px;
}

.ultraguard-data-table td.ultraguard-cell-actions .ultraguard-button-icon-only .dashicons,
.ultraguard-cell-actions:not(td) .ultraguard-button-icon-only .dashicons,
.ultraguard-row-actions .ultraguard-button-icon-only .dashicons {
  width: 14px;
  height: 14px;
  font-size: 14px;
}

/* Long-content cells */
.ultraguard-data-table td.ultraguard-cell-uri,
.ultraguard-data-table td.ultraguard-cell-file,
.ultraguard-data-table td.ultraguard-cell-endpoint,
.ultraguard-data-table td.ultraguard-cell-path,
.ultraguard-data-table td.ultraguard-cell-request_uri,
.ultraguard-data-table td.ultraguard-cell-location,
.ultraguard-data-table td.ultraguard-cell-url {
  max-width: 0;
}

.ultraguard-data-table td.ultraguard-cell-uri > .ultraguard-cell-inner,
.ultraguard-data-table td.ultraguard-cell-file > .ultraguard-cell-inner,
.ultraguard-data-table td.ultraguard-cell-endpoint > .ultraguard-cell-inner,
.ultraguard-data-table td.ultraguard-cell-path > .ultraguard-cell-inner,
.ultraguard-data-table td.ultraguard-cell-request_uri > .ultraguard-cell-inner,
.ultraguard-data-table td.ultraguard-cell-location > .ultraguard-cell-inner,
.ultraguard-data-table td.ultraguard-cell-url > .ultraguard-cell-inner {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   PROGRESS
   ========================================================================== */
.ultraguard-security-suitegress-container {
  margin-bottom: var(--ug-spacing-lg);
  background: var(--ug-bg-primary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-md);
  padding: var(--ug-spacing-lg);
}

.ultraguard-security-suitegress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--ug-spacing-sm);
}

.ultraguard-security-suitegress {
  width: 100%;
  height: 12px;
  background: var(--ug-bg-tertiary);
  border-radius: 6px;
  overflow: hidden;
}

.ultraguard-security-suitegress-bar {
  height: 100%;
  background: var(--ug-gradient-primary);
  transition: width var(--ug-transition-slow);
  border-radius: 6px;
}

.ultraguard-security-suitegress-primary { background: var(--ug-gradient-primary) !important; }
.ultraguard-security-suitegress-success { background: var(--ug-gradient-success) !important; }
.ultraguard-security-suitegress-warning { background: var(--ug-gradient-warning) !important; }
.ultraguard-security-suitegress-error   { background: var(--ug-gradient-error)   !important; }

.ultraguard-security-suitegress-small  { height: 6px; }
.ultraguard-security-suitegress-medium { height: 12px; }
.ultraguard-security-suitegress-large  { height: 20px; }

/* ==========================================================================
   ALERT BOXES
   ========================================================================== */
.ultraguard-alert,
.ultraguard-alert-box {
  position: relative;
  padding: var(--ug-spacing-md) var(--ug-spacing-lg);
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--ug-radius-md);
  margin-bottom: var(--ug-spacing-md);
  display: flex;
  align-items: flex-start;
  gap: var(--ug-spacing-md);
}

.ultraguard-alert .dashicons,
.ultraguard-alert-box .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ultraguard-alert-info    { background: #e3f2fd; border-color: var(--ug-info, #0277bd);   color: #004c8c; }
.ultraguard-alert-success { background: #e8f5e9; border-color: var(--ug-success);         color: var(--ug-success-dark); }
.ultraguard-alert-warning { background: #fff8e1; border-color: var(--ug-warning);         color: var(--ug-warning-dark); }
.ultraguard-alert-error,
.ultraguard-alert-danger  { background: #fce4ec; border-color: var(--ug-error);           color: var(--ug-error-dark); }

.ultraguard-alert-content {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ultraguard-alert-title {
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ultraguard-alert-message {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.92;
}

.ultraguard-alert-dismiss {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.6;
  transition: opacity var(--ug-transition-fast);
}

.ultraguard-alert-dismiss:hover { opacity: 1; }

/* Actions inside alert-box stack below the message */
.ultraguard-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.ultraguard-alert-actions .ultraguard-button {
  flex-shrink: 0;
}

/* ==========================================================================
   TOAST MESSAGES
   ========================================================================== */
.ultraguard-toast-container {
  position: fixed;
  top: 40px;
  right: 24px;
  z-index: var(--ug-z-tooltip, 100002);
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.ultraguard-toast-message {
  background: var(--ug-bg-primary);
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--ug-radius-lg);
  padding: var(--ug-spacing-md) var(--ug-spacing-lg);
  margin-bottom: var(--ug-spacing-sm);
  box-shadow: var(--ug-shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-md);
  width: 100%;
  min-height: 72px;
  pointer-events: all;
  will-change: opacity, transform;
  transform: translateX(120%);
  opacity: 0;
  transition: transform var(--ug-transition-base), opacity var(--ug-transition-base);
  position: relative;
}

.ultraguard-toast-show {
  transform: translateX(0);
  opacity: 1;
}

.ultraguard-toast-icon-wrapper {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ug-radius-round);
  background: var(--ug-bg-secondary);
}

.ultraguard-toast-icon {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.ultraguard-toast-content {
  flex: 1;
  min-width: 0;
  padding-right: 32px;
}

.ultraguard-toast-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ug-light);
}

.ultraguard-toast-text {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  color: var(--ug-white);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ultraguard-toast-close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ug-gray);
  border-radius: var(--ug-radius-round);
  opacity: 0.6;
  transition: opacity var(--ug-transition-fast);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.ultraguard-toast-close:hover { opacity: 1; }

.ultraguard-toast-success { border-color: rgba(16,185,129,.35);  background: linear-gradient(135deg,rgba(16,185,129,1),var(--ug-bg-primary)); }
.ultraguard-toast-error   { border-color: rgba(239,68,68,.35);   background: linear-gradient(135deg,rgba(239,68,68,1),var(--ug-bg-primary)); }
.ultraguard-toast-warning { border-color: rgba(245,158,11,.35);  background: linear-gradient(135deg,rgba(245,158,11,1),var(--ug-bg-primary)); }
.ultraguard-toast-info    { border-color: rgba(14,165,233,.35);  background: linear-gradient(135deg,rgba(14,165,233,1),var(--ug-bg-primary)); }

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.ultraguard-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  flex: 1;
}

.ultraguard-pagination-prev,
.ultraguard-pagination-next,
.ultraguard-pagination-page {
  padding: 5px 10px;
  border: 1px solid var(--ug-border);
  background: var(--ug-bg-primary);
  color: var(--ug-dark);
  text-decoration: none;
  border-radius: var(--ug-radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--ug-transition-fast), border-color var(--ug-transition-fast);
  min-width: 34px;
  text-align: center;
}

.ultraguard-pagination-prev:hover,
.ultraguard-pagination-next:hover,
.ultraguard-pagination-page:hover {
  background: var(--ug-bg-tertiary);
  border-color: var(--ug-gray-lighter);
}

.ultraguard-pagination-page.ultraguard-pagination-active {
  background: var(--ug-primary);
  color: #fff;
  border-color: var(--ug-primary);
}

/* ==========================================================================
   JS-STATE CLASSES (toggled by ultraguard-core.js)
   ========================================================================== */
.ultraguard-loading {
  position: relative;
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
}

.ultraguard-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: ultraguard-spin 0.7s linear infinite;
}

.ultraguard-field-error .ultraguard-field,
.ultraguard-field.ultraguard-field-error {
  border-color: var(--ug-error) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12) !important;
}

.ultraguard-field-error-message {
  display: block;
  font-size: 12px;
  color: var(--ug-error);
  margin-top: 4px;
}

.ultraguard-stat-updated {
  animation: ug-stat-flash 0.5s ease-out;
}

@keyframes ug-stat-flash {
  0%   { color: var(--ug-primary); }
  100% { color: inherit; }
}

.ug-btn-scanning {
  opacity: 0.75;
  cursor: not-allowed;
  position: relative;
}

/* ug-badge-* runtime colour classes */
.ug-badge-success,
.ug-badge-ok,
.ug-badge-protected,
.ug-badge-excellent { background: rgba(16,185,129,.12); color: var(--ug-success-dark); }
.ug-badge-good      { background: rgba(101,163,13,.12);  color: #3f6212; }
.ug-badge-inactive  { background: var(--ug-bg-tertiary); color: var(--ug-gray); }
.ug-badge-critical,
.ug-badge-danger    { background: rgba(239,68,68,.12);   color: var(--ug-error-dark); }

/* ==========================================================================
   ICON SELECTOR
   ========================================================================== */
.ultraguard-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 5px;
  padding: var(--ug-spacing-sm);
  background: var(--ug-bg-secondary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-md);
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.ultraguard-icon-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ug-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--ug-transition-fast), border-color var(--ug-transition-fast);
  background: var(--ug-bg-primary);
}

.ultraguard-icon-item:hover { background: var(--ug-bg-tertiary); border-color: var(--ug-border); }
.ultraguard-icon-item.ultraguard-icon-selected { background: rgba(14,165,233,.1); border-color: var(--ug-primary); }
.ultraguard-icon-item .dashicons { font-size: 18px; width: 18px; height: 18px; color: var(--ug-gray); }
.ultraguard-icon-item:hover .dashicons,
.ultraguard-icon-item.ultraguard-icon-selected .dashicons { color: var(--ug-primary); }

/* ==========================================================================
   LIST INSIDE CARD — strip duplicate border/padding
   ========================================================================== */
.ultraguard-card-body .ultraguard-list {
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  background: transparent;
}

.ultraguard-card-body .ultraguard-list-item {
  padding: var(--ug-spacing-sm) var(--ug-spacing-xs);
}

/* ==========================================================================
   QUICK ACCESS TILE TABLE (dashboard)
   ========================================================================== */
#dashboard-module-tiles-card .ultraguard-card-body table {
  border-collapse: collapse;
  width: 100%;
}

#dashboard-module-tiles-card .ultraguard-card-body td {
  padding: 9px 7px;
  vertical-align: middle;
  font-size: 13px;
  color: var(--ug-dark);
}

#dashboard-module-tiles-card .ultraguard-card-body td:first-child {
  width: 36px;
  text-align: center;
  padding-left: 0;
}

#dashboard-module-tiles-card .ultraguard-card-body td:first-child .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  color: var(--ug-primary);
}

#dashboard-module-tiles-card .ultraguard-card-body td:nth-child(2) { font-weight: 600; }
#dashboard-module-tiles-card .ultraguard-card-body td:nth-child(3) { color: var(--ug-gray); font-size: 12px; }
#dashboard-module-tiles-card .ultraguard-card-body td:last-child   { width: 90px; text-align: right; padding-right: 0; }
#dashboard-module-tiles-card .ultraguard-card-body hr { border: none; border-top: 1px solid var(--ug-border); margin: 0; }

/* Protection Coverage card (dashboard) */
#dashboard-protection-coverage-card .ultraguard-card-body {
  padding: 12px !important;
}

#dashboard-protection-coverage-card .ultraguard-component {
  margin-bottom: 10px !important;
}

#dashboard-protection-coverage-card .ultraguard-component:last-child {
  margin-bottom: 0 !important;
}

#dashboard-protection-coverage-card .ultraguard-security-suitegress-header {
  margin-bottom: 6px !important;
}

#dashboard-protection-coverage-card .ultraguard-security-suitegress-title {
  margin: 0 !important;
  font-size: 13px;
  line-height: 1.35;
}

#dashboard-protection-coverage-card .ultraguard-security-suitegress-container {
  padding: 8px 10px !important;
  margin-bottom: 10px !important;
}

#dashboard-protection-coverage-card .ultraguard-security-suitegress-label {
  margin-bottom: 4px !important;
}

#dashboard-protection-coverage-card .ultraguard-security-suitegress-container:last-child {
  margin-bottom: 0 !important;
}

/* ==========================================================================
   TWO-COLUMN FORM FIELD LAYOUT
   Used by FormRenderer::render_field_wrapper() — every settings field row
   ========================================================================== */
.ultraguard-two-column {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0 var(--ug-spacing-md);
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--ug-border);
}

.ultraguard-two-column:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.ultraguard-card-body .ultraguard-two-column:first-child {
  padding-top: 0;
}

.ultraguard-field-label-column {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 7px;
  padding-right: var(--ug-spacing-sm);
}

.ultraguard-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ug-dark);
  text-align: right;
  line-height: 1.4;
  cursor: pointer;
}

.ultraguard-field-input-column {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
  min-width: 0;
}

.ultraguard-field-input-column > * {
  max-width: 100%;
}

.ultraguard-field-input-column > .ultraguard-button-group,
.ultraguard-field-input-column > .ultraguard-table-container,
.ultraguard-field-input-column > .ultraguard-data-table-wrapper,
.ultraguard-field-input-column > .ultraguard-grid,
.ultraguard-field-input-column > .ultraguard-card-grid {
  width: 100%;
}

.ultraguard-field-help {
  font-size: 12px;
  color: var(--ug-gray);
  margin: 5px 0 0;
  line-height: 1.5;
}

/* Toggle rows — vertically centre the slider with the label */
.ultraguard-two-column .ultraguard-toggle {
  padding: 2px 0;
  min-height: 28px;
}

/* Align the label column with toggle height */
.ultraguard-two-column:has(.ultraguard-toggle) .ultraguard-field-label-column {
  padding-top: 4px;
}

/* form-label (standalone usage outside two-column) */
.ultraguard-form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ug-dark);
  line-height: 1.4;
}

/* Responsive — stack on narrow screens */
/* ==========================================================================
   NUMBER FIELD WRAPPER
   ========================================================================== */
.ultraguard-number-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--ug-spacing-sm);
  flex-wrap: wrap;
  min-width: 0;
}

.ultraguard-number-input-wrapper .ultraguard-field {
  flex: 1 1 180px;
  min-width: 0;
}

.ultraguard-number-unit {
  font-size: 12px;
  color: var(--ug-gray);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   CARD VARIANTS emitted by WidgetRenderer
   ========================================================================== */

/* Card icon — small coloured square shown in card-grid/info cards */
.ultraguard-card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 165, 233, .10);
  border-radius: var(--ug-radius-sm);
  flex-shrink: 0;
}

.ultraguard-card-icon .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  color: var(--ug-primary);
}

/* card-content — paragraph-style body used in some widget cards */
.ultraguard-card-content {
  padding: var(--ug-spacing-md);
  font-size: 13px;
  color: var(--ug-text, var(--ug-dark));
  line-height: 1.6;
}

/* card-grid — wrapper for a group of small cards in a row */
.ultraguard-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--ug-spacing-md);
  margin-bottom: var(--ug-spacing-md);
}

.ultraguard-card-grid-title {
  font-size: var(--ug-font-size-sm);
  font-weight: 600;
  color: var(--ug-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 var(--ug-spacing-sm);
}

/* ==========================================================================
   LIST ITEM EXTENSIONS
   ========================================================================== */

/* Badge inside a list item — floats to the right */
.ultraguard-list-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  margin-left: auto;
  flex-shrink: 0;
  background: rgba(14, 165, 233, .10);
  color: var(--ug-primary);
}

.ultraguard-list-badge.ultraguard-badge-success  { background: rgba(16,185,129,.12); color: var(--ug-success-dark); }
.ultraguard-list-badge.ultraguard-badge-warning  { background: rgba(245,158,11,.12); color: var(--ug-warning-dark); }
.ultraguard-list-badge.ultraguard-badge-danger,
.ultraguard-list-badge.ultraguard-badge-error    { background: rgba(239,68,68,.10);  color: var(--ug-error-dark); }
.ultraguard-list-badge.ultraguard-badge-secondary{ background: var(--ug-bg-tertiary); color: var(--ug-gray); }
.ultraguard-list-badge.ultraguard-badge-info     { background: rgba(2,119,189,.10);  color: #004c8c; }
.ultraguard-list-badge.ultraguard-badge-primary  { background: rgba(14,165,233,.10); color: var(--ug-primary-dark, var(--ug-primary)); }

/* Action buttons cluster inside a list item */
.ultraguard-list-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

/* When BOTH badge and actions exist, actions push right of badge */
.ultraguard-list-item .ultraguard-list-badge + .ultraguard-list-item-actions {
  margin-left: var(--ug-spacing-sm);
}

/* List-item text + description block */
.ultraguard-list-item-text {
  flex: 1;
  display: block;
  min-width: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ultraguard-list-item-description {
  font-size: 12px;
  color: var(--ug-gray);
  margin-top: 2px;
  line-height: 1.4;
}

/* ug-check-pass / ug-check-fail — used by HardeningPage checklist */
.ug-check-pass { color: var(--ug-success); }
.ug-check-fail { color: var(--ug-error-dark); }

/* ==========================================================================
   STAT CARD DESCRIPTION
   ========================================================================== */
.ultraguard-stat-description {
  font-size: 12px;
  color: var(--ug-gray);
  line-height: 1.4;
  margin-top: 3px;
}

/* ==========================================================================
   APP SIDEBAR — CHILD NAVIGATION
   Emitted by Admin::render_app_shell() but was missing all CSS.
   ========================================================================== */
/* Sidebar nav — structural rules live in admin-base.css.
   Only visual / theme overrides here. */

.ultraguard-app-sidebar-children.expanded {
  background: rgba(15, 23, 42, 0.03);
  box-shadow: inset 3px 0 0 rgba(15, 23, 42, 0.07);
}

.ultraguard-app-sidebar-item.has-children.expanded > .ultraguard-app-sidebar-link {
  background: rgba(15, 23, 42, 0.035);
}

/* Arrow rotates when expanded */
.ultraguard-app-sidebar-item.has-children.expanded
  > .ultraguard-app-sidebar-link
  .ultraguard-app-sidebar-arrow {
  transform: rotate(90deg);
}

/* Parent overview link */
.ultraguard-app-sidebar-child-link.ultraguard-parent-overview {
  color: var(--ug-gray);
}

/* ==========================================================================
   MISC MISSING CLASSES from renderers
   ========================================================================== */

/* Required field asterisk */
.ultraguard-required {
  color: var(--ug-error);
  margin-left: 2px;
  font-weight: 700;
}

/* Inline spinner used in loading states */
.ultraguard-spin-icon {
  animation: ultraguard-spin 1s linear infinite;
  display: inline-flex;
}

/* Empty / gathering state placeholder */
.ultraguard-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--ug-gray);
  gap: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.96));
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: var(--ug-radius-lg);
}

.ultraguard-empty-message {
  font-size: 13px;
  color: var(--ug-gray);
  margin: 0;
  max-width: 320px;
  line-height: 1.5;
}

/* Metric panel — used in some security dashboard widgets */
.ultraguard-metric-panel {
  background: var(--ug-bg-secondary);
  border: 1px solid var(--ug-border);
  border-radius: var(--ug-radius-md);
  padding: var(--ug-spacing-md);
  margin-bottom: var(--ug-spacing-sm);
}

.ultraguard-metric-panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ug-gray);
  margin: 0 0 var(--ug-spacing-sm);
}

/* ==========================================================================
   SPECIALIZED WIDGET SURFACES
   ========================================================================== */
.ultraguard-ssl-status-icon {
  border-radius: 999px;
}

.ultraguard-ssl-status-icon-valid,
.ultraguard-ssl-status-icon-warning,
.ultraguard-ssl-status-icon-expired,
.ultraguard-ssl-status-icon-invalid,
.ultraguard-ssl-status-icon-unknown {
  color: var(--ug-gray);
}

.ultraguard-ssl-status-icon-valid {
  color: #10b981;
}

.ultraguard-ssl-status-icon-warning {
  color: #f59e0b;
}

.ultraguard-ssl-status-icon-expired,
.ultraguard-ssl-status-icon-invalid {
  color: #ef4444;
}

.ultraguard-ssl-status-icon-unknown {
  color: #94a3b8;
}

.ultraguard-integrity-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ultraguard-integrity-stat,
.ultraguard-performance-metric {
  min-width: 0;
  padding: 12px 10px;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--ug-radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
}

.ultraguard-integrity-value,
.ultraguard-performance-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--ug-dark);
  line-height: 1.2;
}

.ultraguard-integrity-value-success,
.ultraguard-performance-value-excellent,
.ultraguard-performance-value-good {
  color: #10b981;
}

.ultraguard-integrity-value-warning,
.ultraguard-performance-value-moderate {
  color: #f59e0b;
}

.ultraguard-integrity-value-danger,
.ultraguard-performance-value-high,
.ultraguard-performance-value-critical {
  color: #ef4444;
}

.ultraguard-integrity-stat small,
.ultraguard-performance-label {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--ug-gray);
  line-height: 1.4;
}

.ultraguard-last-scan {
  margin: 12px 0 0;
  font-size: 12px;
  color: #64748b;
}

.ultraguard-performance-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

.ultraguard-performance-badge {
  background: rgba(15, 23, 42, 0.06);
}

.ultraguard-performance-badge-excellent,
.ultraguard-performance-badge-good {
  color: #10b981;
}

.ultraguard-performance-badge-moderate {
  color: #b45309;
}

.ultraguard-performance-badge-high,
.ultraguard-performance-badge-critical {
  color: #b91c1c;
}

.ultraguard-security-dashboard-item {
  min-width: 0;
}

.ultraguard-form-select .ultraguard-field[multiple] {
  background-image: none;
  padding-right: 13px;
}

.ultraguard-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ug-spacing-sm);
  padding: 4px 0;
}

.ultraguard-metric-label {
  font-size: 13px;
  color: var(--ug-dark);
}

.ultraguard-metric-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ug-dark);
}

/* ==========================================================================
   CARD BODY — ensure fields inside don't bleed outside the card
   ========================================================================== */
.ultraguard-card-body .ultraguard-two-column:last-child {
  border-bottom: none;
}

/* Give a small bottom gap after the last field block in a card */
.ultraguard-card-body > .ultraguard-two-column:only-child {
  padding: 8px 0;
}

/* ==========================================================================
   CARD BODY PADDING ADJUSTMENT FOR FORM FIELDS
   When card body contains two-column field rows, reduce vertical padding
   so fields don't get double-padded (card body + field row both add space).
   ========================================================================== */

/* Card body with form fields — use horizontal padding only */
.ultraguard-card-body:has(> .ultraguard-two-column) {
  padding-top: 4px;
  padding-bottom: 8px;
}

/* Fallback for browsers without :has() support — the field rows look fine
   with the standard 16px padding, it's just a little extra breathing room */

/* ==========================================================================
   MOBILE & TABLET COMPONENT FIXES
   ========================================================================== */

/* ── Data tables: horizontal scroll on all small screens ─────────────────── */
/* ── Cards: no horizontal overflow ───────────────────────────────────────── */
/* ── Stat cards: responsive grid ─────────────────────────────────────────── */
/* ── Alert boxes: reduce padding on mobile ───────────────────────────────── */
/* ── Progress bars: label wrapping ───────────────────────────────────────── */
/* ── Toggle: full width on mobile ────────────────────────────────────────── */
/* ── Charts: no overflow ─────────────────────────────────────────────────── */
/* ── Key-value lists: stack on mobile ────────────────────────────────────── */
/* ── Code blocks: horizontal scroll ─────────────────────────────────────── */
/* ── Button group connected: stack on mobile ─────────────────────────────── */
/* ── Upsell card: mobile friendly ───────────────────────────────────────── */
/* Pro upsell card — consistent layout at all sizes */
.ultraguard-security-suite-upsell-card {
  border-left: 4px solid var(--ug-primary) !important;
}

.ultraguard-security-suite-upsell-card .ultraguard-button-group {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Retention hint (orange warning with upgrade button) */
.ultraguard-alert-warning .ultraguard-alert-actions .ultraguard-button {
  white-space: nowrap;
}


/* ── iOS font-size fix: prevent zoom on input focus ─────────────────────── */

/* ── Responsive breakpoints (consolidated) ──────────────────────────── */

@media screen and (max-width: 1024px) {
.ultraguard-data-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin: 0 -2px;
    padding: 0 2px;
  }

  .ultraguard-data-table {
    min-width: 540px;
  }

  /* Reduce cell padding on tablet */
  .ultraguard-data-table th,
  .ultraguard-data-table td {
    padding: 8px 10px;
    font-size: 12.5px;
  }
.ultraguard-card {
    overflow: hidden;
    min-width: 0;
  }

  .ultraguard-card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .ultraguard-card-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .ultraguard-card-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
.ultraguard-stat-card {
    min-width: 0;
  }
}

@media (max-width: 1024px) {
.ultraguard-form-container {
    padding: 20px;
  }

  .ultraguard-form-grid,
  .ultraguard-form-row-full {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ultraguard-form-row {
    display: grid;
    gap: 12px;
  }

  .ultraguard-form-label {
    justify-content: flex-start;
    text-align: left;
    padding-bottom: 0;
  }

  .ultraguard-form-input {
    padding-top: 0;
  }

  .ultraguard-form-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .ultraguard-tabs-vertical {
    flex-direction: column;
    min-height: 0;
  }

  .ultraguard-tabs-vertical .ultraguard-tab-nav {
    flex-direction: row;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--ug-border);
    margin-bottom: 0;
    overflow-x: auto;
  }

  .ultraguard-tabs-vertical .ultraguard-tab-nav-item {
    flex: 0 0 auto;
  }

  .ultraguard-tabs-vertical .ultraguard-tab-nav-item.ultraguard-tab-active .ultraguard-tab-nav-link {
    border-left: none;
    border-bottom: 2px solid var(--ug-primary);
    border-radius: var(--ug-radius-sm);
  }

  .ultraguard-tabs-vertical .ultraguard-tab-content {
    padding: 18px;
  }

  .ultraguard-table-toolbar,
  .ultraguard-table-footer {
    align-items: stretch;
  }

  .ultraguard-bulk-actions,
  .ultraguard-search-form {
    width: 100%;
    flex-wrap: wrap;
  }

  .ultraguard-table-search {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }
}

@media screen and (max-width: 782px) {
.ultraguard-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .ultraguard-modal {
    max-width: 100% !important;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--ug-radius-lg) var(--ug-radius-lg) 0 0;
    margin: 0;
  }

  .ultraguard-modal-header {
    padding: 16px 18px;
    position: sticky;
    top: 0;
    background: var(--ug-bg-primary);
    z-index: 1;
    flex-shrink: 0;
  }

  .ultraguard-modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(92vh - 130px);
    flex: 1;
  }

  .ultraguard-modal-footer {
    padding: 12px 18px;
    position: sticky;
    bottom: 0;
    background: var(--ug-bg-primary);
    border-top: 1px solid var(--ug-border);
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
  }

  .ultraguard-modal-footer .ultraguard-button {
    flex: 1 1 auto;
    justify-content: center;
  }
.ultraguard-data-table {
    min-width: 480px;
  }

  .ultraguard-data-table th,
  .ultraguard-data-table td {
    padding: 7px 9px;
    font-size: 12px;
  }

  /* Row actions: stack or shrink */
  .ultraguard-row-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Search/filter bar: stack on mobile */
  .ultraguard-table-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ultraguard-table-search {
    width: 100%;
  }

  /* Pagination: center and wrap */
  .ultraguard-pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
  }
.ultraguard-stat-card-value {
    font-size: 22px;
  }

  .ultraguard-stat-card-label {
    font-size: 11px;
  }
.ultraguard-alert-box,
  .ultraguard-notice {
    padding: 12px 14px;
    font-size: 13px;
  }

  .ultraguard-alert-box-actions {
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
  }

  .ultraguard-alert-box-actions .ultraguard-button {
    flex: 1 1 auto;
    justify-content: center;
  }
.ultraguard-security-suitegress-header {
    flex-wrap: wrap;
    gap: 4px;
  }
.ultraguard-field-toggle {
    padding: 12px 0;
  }

  .ultraguard-toggle-row {
    flex-wrap: wrap;
    gap: 8px;
  }
.ultraguard-chart-container {
    overflow: hidden;
    touch-action: pan-y;
  }

  canvas {
    max-width: 100%;
    height: auto !important;
  }
.ultraguard-kv-row {
    flex-direction: column;
    gap: 2px;
    padding: 10px 0;
  }

  .ultraguard-kv-key {
    font-weight: 600;
    width: 100%;
  }

  .ultraguard-kv-value {
    width: 100%;
    text-align: left;
  }
.ultraguard-code,
  pre.ultraguard-pre {
    overflow-x: auto;
    font-size: 11.5px;
    -webkit-overflow-scrolling: touch;
  }
.ultraguard-security-suite-upsell-card .ultraguard-button-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ultraguard-security-suite-upsell-card .ultraguard-button {
    width: 100%;
    justify-content: center;
  }
.ultraguard-field,
  .ultraguard-select,
  input[type="text"].ultraguard-field,
  input[type="email"].ultraguard-field,
  input[type="password"].ultraguard-field,
  input[type="number"].ultraguard-field,
  input[type="search"].ultraguard-field,
  textarea.ultraguard-field,
  select.ultraguard-field {
    font-size: 16px;   /* prevents iOS Safari auto-zoom on focus */
  }
}

@media (max-width: 782px) {
.ug-scan-live-stats .ultraguard-list-item,
  .fc-live-stats-row .ultraguard-list-item,
  .ug-db-scan-stats .ultraguard-list-item {
    flex-basis: 100%;
  }
.ultraguard-card,
  .ultraguard-table-wrapper,
  .ultraguard-tabs,
  .ultraguard-form-container {
    border-radius: var(--ug-radius-md);
  }

  .ultraguard-card-header,
  .ultraguard-card-body,
  .ultraguard-card-footer,
  .ultraguard-tab-content {
    padding: 14px;
  }

  .ultraguard-data-table {
    font-size: 12px;
  }

  .ultraguard-data-table th,
  .ultraguard-data-table td {
    padding: 10px 12px;
  }

  .ultraguard-form-actions .ultraguard-button,
  .ultraguard-form-actions .button,
  .ultraguard-search-form .button,
  .ultraguard-search-form .ultraguard-button,
  .ultraguard-bulk-actions .button,
  .ultraguard-bulk-actions .ultraguard-button {
    width: 100%;
  }
}

@media (max-width: 780px) {
.ultraguard-card-header {
    align-items: stretch;
  }

  .ultraguard-card-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .ultraguard-card-actions .ultraguard-button-group,
  .ultraguard-card-actions .ultraguard-button {
    width: 100%;
  }

  .ultraguard-button-group {
    width: 100%;
  }

  .ultraguard-button-group > .ultraguard-button,
  .ultraguard-button-group > .button,
  .ultraguard-button-group > button,
  .ultraguard-button-group > a {
    flex: 1 1 100%;
  }

  .ultraguard-table-toolbar,
  .ultraguard-table-footer {
    align-items: stretch;
  }

  .ultraguard-table-search {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }

  .ultraguard-integrity-stats {
    grid-template-columns: 1fr;
  }

  .ultraguard-performance-metrics {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (max-width: 680px) {
.ultraguard-two-column {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .ultraguard-field-label-column {
    justify-content: flex-start;
    padding-top: 0;
    padding-right: 0;
  }
  .ultraguard-field-label {
    text-align: left;
  }
.ultraguard-toast-container {
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
  }

  .ultraguard-toast-message {
    min-height: 0;
  }
}

@media screen and (max-width: 480px) {
.ultraguard-button-group-connected .ultraguard-button {
    border-radius: var(--ug-radius-md) !important;
    border: 1px solid var(--ug-border) !important;
  }
}
